[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 28
File: K&R himegoto waifux2.png (1 MB, 1000x1400) Image search: [Google]
K&R himegoto waifux2.png
1 MB, 1000x1400
old thread: >>52375963

What are you working on, /g/?
>>
First for Java
>>
Using Linux, what is best text editor for programming?
>>
>>52386181
ed
>>
>>52386154
roboshit with arduino, I thought it would be fun to whip up something.
>>
UPDATED LMAO
>>
>>52386148

send help.
>>
>>52386189
What about vim or Emacs?
>>
>>52386215
>fuck sjws
Or the best way to stay virgin
>>
>>52386181
Vim/Atom
>>
>>52386246
all girls are SJW?
>>
Friendly reminder that the hot pocket brigade is going around deleting all anime posts and handing out 3 day bans.

Also, how does /g/ feel about casting the return value of mallocs and 3-level pointer indirection?
>>
>>52386154
first for Microsoft Visual Studio and C#
>>
>>52386244
?
>>
>>52386274
of course
>>
>>52386282
HE ASKED, WHAT ABOUT VIM OR EMACS?
>>
>>52386246
more like best way to avoid crazy women
>>
>>52386274
No but if you openly hate sjws, you have two strikes against you.
>>
>>52386291
?
>>
Reposting problem because I simply don't understand why this is happening, or how to fix it.

http://pastebin.com/ieK5YazG

Both lists end up identical, 5 random words are returned, but both lists contain the same 5 random words.

Why? Why is this happening?
>>
>>52386304
???
???
???
>>
>>52386274
When you express hatred for social justice it makes you look sexist, bigoted and "non-progressive".
Really, this should have been worded better.
All girls are "progressive" these days, and if you're not on board with progressive, like worshipping LGBT people and calling trans people "brave" then there's something wrong with you.
>>
>>52386314
Your text to voice is shit.
>>
What are the differences between emacs and vim? Which one should i go with?
>>
>>52386215

Congrations, you done it.
>>
>>52386344
>composition/division
>worshipping LGBT
>"brave"

so you're an SJW then
>>
>>52386397
:)
>>
>>52386397
Hey, OSGTP, you use C#.

>>52386331
Send help?

Code is dog ugly, but the thing functions, just not very well apparently.
>>
>>52386215
Add text rotation effect.
>>
So I'm working on this project that has a bunch of spaceships objects. These objects have a bunch of attributes (health, speed, ect...).
I've asked before and hardcoding these spaceship objects into the source code itself is sloppy coding.
So my thinking is I'll load the values in through a different file. My question is what is the "best" way to load these values into my program? I'm familiar with JSON, but I want to hear some other opinions. I'm writing this in c++ btw.
>>
>>52386274
In Germany I found that most girls don't even know what SJW are and don't want any special treatment
>>
>>52386483
csv?
>>
What are the languages you enjoy the most reading?
Those with the most beautiful code?
>>
>>52386483
>hardcoding these spaceship objects into the source code itself is sloppy coding
Why do they say that? I think it's perfectly fine to hardcode those values.
>>
>>52386433
It's added bruh
>>
>>52386491
This is true for much of Europe. SJW is mostly an NA thing.
>>52386509
Go, but that is partly because of gfmt.
>>
>>52386509
Python obviously
>>
>>52386509
Python

except when dealing with classes because of all the self.'s
>>
>>52386509
c++ when the programmer is competent
>>
>>52386524
Oh, sorry, i'm blind as fuck.
>>
>>52386509
I don't like reading code in any language. Thats why I prefer languages with expressive type systems, because the semantics of the cde can be infered from the type.
>>
>>52386551
Then just don't use classes. S I M P L E
>>
>>52386558
http://fabiensanglard.net/doom3/index.php
>>
C++
>>
>>52386181
Vim
>>
>>52386592
What makes you think I do?
>>
>>52386623
Because you decided to make a comment about it. Maybe because of "bad" memories.
>>
File: ss1.png (108 KB, 960x827) Image search: [Google]
ss1.png
108 KB, 960x827
>>52386154
>>
>>52386344
maybe if you're a cuck
>>
What's the best, most used, actively maintained Python 3 game engine?
>>
>>52386721
what

the

fuck

is

this

spaghett

code
>>
>>52386921
>lurk moar newfag
https://codeshare.io/ju9Cl
>>
>>52386914
fuck python get UE4
>>
How long would it take to learn enough C to get a job, assuming I studied for at least a few hours every day?

I was reading Stephen Prata's C book a while back but lost interest, I want to pick it back up since life has taken a turn for the very worst. Bit of a last ditch effort to get a job.
>>
Daily reminder that anime is trash and weebs have been statistically proven to be bad programmers
>>
void updateArray(string[] _array, string _string)
{
if(_array != null)
{
int newLenght = _array.Length + 1;
string[] oldArray = _array;
_array = new string[newLenght];

for (int i = 0; i < oldArray.Length; i++)
{
_array[i] = oldArray[i];
}

_array[newLenght - 1] = _string;

} else
{
_array = new string[1] { _string };
}
}


What is wrong with that piece of code. the else part won't work
>>
how hard will it be going from C++ to C and Java?
>>
>>52386935
either im banned from this shit or i broke the entire site. im cool with either.
>>
>>52386721
>https://codeshare.io/ju9Cl
>just got rekt
>>
>>52387047
not hard if you know OOP well
>>
>>52387057
turn on incognito mode
>>
i guess if you paste a million lines it spazzes out a bit. ehueh
>>
>>52386483
base64 encoded xml
>>
>>52386509
javascript
>>
>>52386420
>Hey, OSGTP, you use C#.

Obviously.
>>
>>52387065
this is autism
>>
>>52386935
r8 my fizzbuzz desu
def fizzbuzz(i):
if i==1: return "1"
if i%15==0: return fizzbuzz(i-1) + '\nfizzbuzz'
if i%3==0: return fizzbuzz(i-1) + '\nfizz'
if i%5==0: return fizzbuzz(i-1) + '\nbuzz'
return fizzbuzz(i-1) + '\n' + str(i)

print(fizzbuzz(100))
>>
DJANGO > RUBY ON RAILS

Prove me wrong, as a pre-requisite you HAVE to be able to develop using a windows computer, despite how shit the OS is without any hacking the configuration.
>>
>>52387232
Can't prove you wrong, Django seems dominant in job searches
>>
>>52387204
>go back to reddit
>>
>>52387216
>recursive
absolutely disgusting
>>
>>52387047
Like going from USA to USSR
>>
>>52387182
Thanks for helping :^)

Figured it out anyways.
>>
>>52387216
2/10

It doesn't matter how aesthetically pleasing a recursive solution may be, i will never support recursive bullshit unless absolutely necessary holy shit i hope no undergraduates fall for this meme shit.
>>
>>52387290

Congrats. I was actually just in the process of testing it out.
>>
>>52387270
>>52387316
Loving
Every
Laugh
>>
Does calling clear() on a vector of pointers delete all the pointers, or will it cause a memory leak?
C++ by the way.
>>
>>52387317
It's the "Random rand = new Random();" decleration

Move it out of the method and it works fine, I didn't read the documentation on it so I didn't really understand.

Now I do though.
>>
>>52387358
>It's the "Random rand = new Random();" decleration

Does it return the same numbers each run?
>>
rate my C++ fizzbuzz
void fizzbuzz()
{
for(int i = 1; i <=100; i++)
{
if(i%3==0)
{
printf("fizz");
}
if(i%5==0)
{
printf("buzz");
}
printf(" ");
}
}
>>
>>52387396
You forgot to check if i % 15==0 print "FizzBuzz"
otherwise good
>>
>>52387374
Yup, based on the system clock, so if you call it twice in quick succession then it just generates an identical string of numbers.

Just declare it once and use the same object.
>>
>>52387425
but if it's divisible by 3 and 5 then that means it's divisible by 15, and in that case it still prints fizzbuzz
>>
>>52387435
doesn't print numbers
>>
>>52387431
>Yup, based on the system clock, so if you call it twice in quick succession then it just generates an identical string of numbers.

Makes sense. You could always use the Random.org API if you need some random numbers based on atmospheric noise. :&)
>>
>>52387451
what?
>>
>>52387435
lose those statement braces for maximum readability
>>
>>52387491
Functional randomness is fine by me when I'm using a dictionary with ~90,000 entries.

If I pushed my project up to github would you mind giving it a quick test? I'm trying to figure out why I'm getting such a low WPM, I assume it's purely because of the readability.

I can't seem to figure out how I'd make it easier to use.
>>
>>52387494
it doesn't print the numbers like a normal fizzbuzz
>>
>>52387519

I can look at it, but I probably won't use it. I don't use scrub-hub.
>>
I am an assfaggot, instead of studying c++ i play league of legends. After this game I will
>>
>>52387316
Just for you my recursion loving friend:
fizz :: [Int] -> IO ()
fizz [] = return ()
fizz (x:xs) = do fizz' x
fizz xs
where
fizz' :: Int -> IO ()
fizz' x | x `mod` 15 == 0 = putStrLn "Fizzbuzz"
| x `mod` 3 == 0 = putStrLn "Fizz"
| x `mod` 5 == 0 = putStrLn "Buzz"
| otherwise = putStrLn $ show x
main :: IO ()
main = fizz [1..100]
>>
>>52387542
You can just download the project as zip and slam it into VS.

And obligatory
>Not using github
Implication.

https://github.com/sirdoombox/FastFingerer

Make sure to check your NuGet console if you do give it a go, packages aren't picked up by github (stupidly)
>>
Reminder that recursion is equivalent in performance to iteration and often much cleaner.
>>
File: ._..png (3 KB, 3840x2160) Image search: [Google]
._..png
3 KB, 3840x2160
>tfw you just made a professional memetext-tornado in C but it's too long to post here
>>
>>52386721
Beautiful
>>
>>52387542
>not having an online portfolio
You're the scrub here m8
>>
File: Yellow_Throated_Marten.jpg (124 KB, 1024x683) Image search: [Google]
Yellow_Throated_Marten.jpg
124 KB, 1024x683
anyone have experience with an HDL? Verilog or VHDL, doesn't matter.
>>
Currently, just some simulation programs for a project I'm figuring. Not revealing too much, but it needs a LOT of research into mob psychology.
>>
>>52387660
then it's too long to post, period.
refactor.
>>
when i installed eclipse it gave a me a choice between a lot of stuff, including one that was for java and one for C and C++. so i chose the java one. but i also am going to be coding in both C and C++ this semester. do i have to install a different environment in addition to eclipse?
>>
>>52387680
I do
>>
>>52387603
>You can just download the project as zip and slam it into VS.

No thanks, m8. I'm good.

Otherwise, it looks okay. It could use a bit of refactoring in some methods, but not too bad. Also I personally prefer to put my declarations at the top of the scope, but maybe that's just autism.
>>
>>52387660
pastebin that shit
>>
>>52386721
>tfw i wrote that main
>>
>>52386304

There are plenty of women who aren't SJWs, who may even hate SJWs due to some of their actions which go against the interests of women.

>>52386483

The best way? Best in what way? If it's performance, then hardcoding is best. If you need modularity, you can easily make a single source fine that just contains a global array and some symbols to export. Otherwise, you've got plenty of options depending on any specific needs you have. If it's relational data, use sqlite. If it's just a config file, any of JSON, XML, INI, CSV, or your own custom binary/text format will do. Since you're most comfortable with JSON, that may be the best option.
>>
>>52387698
I'd need to cut off 1800 characters or about 50%
>>
Is there anything like ssms for linux?
I need to administer an Azure SQL database...
>>
>>52387707
I usually do that, but I had so much shit flying around and my code was starting to get a bit messy, so I just stuck things where I was using them and let the mess just accumulate.
>>
>>52387396
Learn with the best:
#include <stdio.h>

main(){
int i;

for(i=1;i<=100;i++){
if(i%3==0 && i%5==0) printf("FizzBuzz\n");
else if(i%3==0) printf("Fizz\n");
else if(i%5==0) printf("Buzz\n");
else printf("%d\n",i);
}
}
>>
>>52387816
>so I just stuck things where I was using them and let the mess just accumulate.

Yeah, that happens, too.
>>
File: Greater_Grison.jpg (180 KB, 1024x685) Image search: [Google]
Greater_Grison.jpg
180 KB, 1024x685
>>52387702
This might be kinda weird, but know anything about dealing with logic primitives directly?
>>
>>52387840
>Invalid C
Get the fuck out. At least adhere to ANSI or ISO C89.
>>
>>52387886
yeah what about
>>
>>52387270
>>52387316
def fizzbuzz(i):
for x in range(1,i+1):
if x%15==0: yield "fizzbuzz"
if x%3==0: yield "fizz"
if x%5==0: yield"buzz"
yield(str(x))
fb = lambda: "\n".join(x for x in fizzbuzz(100))
timeit.timeit(fb) # 76.0133

def fizzbuzz_rec(i):
if i==1: return "1"
if i%15==0: return fizzbuzz_rec(i-1) + '\nfizzbuzz'
if i%3==0: return fizzbuzz_rec(i-1) + '\nfizz'
if i%5==0: return fizzbuzz_rec(i-1) + '\nbuzz'
return fizzbuzz_rec(i-1) + '\n' + str(i)
fb_rec = lambda: fizzbuzz_rec(100)
timeit.timeit(fb_rec) #61.027


TOP KEK
>>
>>52386483
If it's a class with a static variable value, then feel free to hardcode it. If you're wanting to go for performance, you might want to load from some sort of delimited text file, in the same order of the file, so something like CSV or TDT.
>>
File: Fisher_Cat.jpg (85 KB, 1024x683) Image search: [Google]
Fisher_Cat.jpg
85 KB, 1024x683
>>52387904
I'm trying to find a way to manipulate either the primitives or logic cells directly. Maybe with a graphical approach or by manipulating the bitstream itself. Any insight?
>>
>>52386551
So you mean any non-shit Python.
>>
>>52387729
here I go
http://pastebin.com/eMtrRJGb
>>
Why is C/C++ interop such a pain.
>Free functions everywhere
>Global state
>If you wrap things up into objects, you still end up with global state/singletons, but now you have tons of boilerplate...
>>
>>52386914
>Python3.x

Less libraries than an African village
>>
>>52387991
have any code written already?
>>
>>52388000
C/C++ interop is using
extern "C"
. Everything else is stuff you are personally doing that is not working.
>>
>>52386940
3 years, that's how long it takes to get a degree.
>>
>>52387901
Stop being such a faggot:

https://ideone.com/lzQdkC
>>
At the gym lads
>>
>>52387353
Anyone?
>>
https://codeshare.io/waa9R
>>
File: Least_Weasel.jpg (63 KB, 800x600) Image search: [Google]
Least_Weasel.jpg
63 KB, 800x600
>>52388050
Unfortunately not, just trying to guage feasability. But if I could do this, wouldn't the code be fairly simple? Say just a list of connections to be made?
>>
>>52388068
>being incapable of reading the documentation
>>
>>52388064
>Works on my machine fallacy
It's still not valid C. It's a language a lot like C, that may or may not work on some C compilers.
>>
File: book.png (16 KB, 362x479) Image search: [Google]
book.png
16 KB, 362x479
>>52388246
According to this book, it's C.
>>
shitpaws are cancer
>>
>>52388293
>book that is over 10 years old
Do you even know what the current fucking year is nigger?
>>
>>52387353
Memory leak, iterate through and call delete then call clear after.
>>
File: D.png (8 KB, 125x95) Image search: [Google]
D.png
8 KB, 125x95
>>52386154
Who D here?
>>
>>52388354
I D here
>>
>>52387353
>making non-owning pointers own things
>>
File: 1451673978244.gif (1 MB, 480x357) Image search: [Google]
1451673978244.gif
1 MB, 480x357
repostan

Can you explain to me how tagged pointers work in C /dpt/, or at least point me in a good direction.

I mean literally how do you program that.
>>
File: 1444711551183.webm (3 MB, 1280x720) Image search: [Google]
1444711551183.webm
3 MB, 1280x720
>>52386491
>>52386528
>live in germany
>go in a front of the room
>say you hate feminism, you are anti equality, you are racist and very religious
>don't get rekt
>>
>>52388310
You stupid fucking cunt... It's the Bible of C.
>>
The most successful /g/ project ( TOX ) is being bashed by the reddit shitheads.

It's time to help!

Make accounts and downvote the naysayers, help our project, /g/!

To the rescue! TOX is the future!

https://www.reddit.com/r/projecttox/comments/40moct/tox_android_client_developer_quits/

We were born here as a /dpt/ project and now it's time to pay us back, /g/

We are counting on you!
>>
>>52387353
>>52388333
Depends on the pointer. Raw pointer or smart pointers? If raw pointers, then provide a deleter for your vector.

>>52388391
This

>>52388397
>tagged pointers
I've never heard this term before, but
https://en.wikipedia.org/wiki/Tagged_pointer
seems to be a good starting point.
>>
>>52388464

Already read that anon, its not much help when you want to look for some example code of actually tagging a pointer.

Basically you modify the address of the pointer to store bits in the last 2(32bit) or 3(64bit), but how to do that it is a mystery.
>>
>>52388464
>>52388531
Unions or bit manipulation
>>
>>52387901
It is ANSI C though anon, or maybe you haven't even read K&R? ;:^)
>>
>>52386175
how do you write oneline fizzbuzz in Java?
>>
>>52388545

So you go
 (A~B); 
or something like that the pointer and thats it?
>>
>>52388601
No..?
>>
>>52388531
>Basically you modify the address of the pointer to store bits in the last 2(32bit) or 3(64bit), but how to do that it is a mystery.

Well, in example 3 they show an example using 16-bit aligned entries. You can exploit this by passing pointer values that aren't 16-bit aligned, using the last bits as metadata.
>>
>>52388609

Then?
>>
>>52386215
>kali 2
cool choice
>>
>>52388566
delete system32
>>
>>52387699
Just don't use Eclipse. Use a text editor (not a CLI based one if you're just learning and are at uni), something like Sublime, and then compile from the CLI to get a good view of how your compiler works.
>>
>>52388614
struct my_data {
char some_data;
int some_other_data;
/* this struct will be padded to fit 16-bit alignment, you can use the padded area for metadata I guess */
};
>>
>>52388623
Depends on your architecture. Just read the fucking Wikipedia page.
>>
File: 1451751832808.png (17 KB, 418x359) Image search: [Google]
1451751832808.png
17 KB, 418x359
>IDEs
>>
>>52388651
No, nevermind, that's not what they mean.
>>
>>52387699
>but i also am going to be coding in both C and C++ this semester. do i have to install a different environment in addition to eclipse?
You can easily install the CDT stuff for Eclipse as an addon.
>>
Anyone know why 1 / 60 returns a 0 in C#?

I want to use some small as fuck numbers, but apparently all I get is 0 when I try to use fractions.

I haven't ever actually had to do maths when programming before.
>>
>>52388717
It's a programming concept known as integer arithmetics. int and int returns int, you need to have a float in there to get a float, so 1.0/60 or 1/60.0
>>
>>52388717
Integer long division

Short answer: Use floating point numbers.
>>
>>52388717
C# is probably calculating that 1/60 as an int which only returns whole numbers. Cast the operation as a float.
>>
>>52386721
public private static class void short long double int sexbang


giggled hard
>>
>>52388735
>>52388755
>>52388759
Ah, I know about integers, doubles, floats, etc.

I just didn't know why it wasn't returning the correct value when I specified the value as a "double", I needed to specify it was a float, didn't really know there was a difference.

For some reason I thought double was what I was after.

Thanks.
>>
Is my program architecture design fundamentally flawed/retarded? Basically I have a large, open world simulation with tens of thousands of agents. It outputs some colored maps and text files. I want to write a real-time 2D visualizer and frontend for it using OpenGL.

My plan is to write the renderer/user-interface as a client that submits requests/queries to the simulation program.

The user hits "New world" button, the renderer submits "New world" request to the simulation server, and it begins work. Once it's finished, the renderer requests the contents of world cells {0, 0} to {512, 512} so it can display them as an interactive map. If the user scrolls the map, then the renderer must submit a new request for, say, the contents of {64, 64} to {576, 576}.

The renderer and the simulation won't share memory (the world is generated on the fly and stored sparsely so I can't just hand over a giant world array pointer).

Is this feasible and performant? Most source code I've seen tightly couples the rendering and simulation, I assume for performance reasons?
>>
>>52388793
Double should work too though.

https://msdn.microsoft.com/en-us/library/678hzkk9.aspx
>>
>>52388833
Oh, so I just had to put a .0 behind my number for it to work.

There we go then.
>>
>>52388815
No, that's a terrible idea. You can keep the client-server architecture, but have the server push deltas and have the client keep track of the full state.
>>
>>52388793
wut? I just tried both float and double casting the whole thing and the numbers in the division and it's the same thing, there shouldn't be a difference
>>
>>52388793
>For some reason I thought double was what I was after.
It is, but "1" and "60" are integer literals.

double a = 1 / 60; // this will still return 0 because 1 and 60 are integers
double b = 1.0 / 60; // now at least one of the numbers are a floating point and will return correct
double c = 1 / 60.0; // same as above
double d = ((double) 1) / 60; // same as above
>>
>>52388862
>>52388884

I forgot to put a ".0" behind the number I was using.

I thought by declaring a float/double it would automatically assume that the values I was using were to be floating point values.

Serves me right for trusting the machines.
>>
>>52388908
>Serves me right for trusting the machines.
Never trust the machines
>>
>>52386483
>hardcoding these spaceship objects into the source code itself is sloppy coding.
No it's not.
Go ahead and do it, it would be cleaner than putting it in a separate file and writing a loader function, and it would be more portable too.
>>
>>52388815
>>52388857
Not the full state, rather, but all it could be expected to show at once (plus a buffer region that ends up being off screen).
Though I guess this is what you started with, now that I think about it.

It's not typical to split the rendering and logic into entirely separate processes like that, though.
>>
>>52386154

I've just started learning to code. You can see below I'm terribly inefficient and just plain wrong.

Anyone have any tips on what I should study to get better or does it just come with practice?

##what i wrote
'''
def finder(a, b):
start = a.find(b)
if start == -1:
return None, 0
end = start + 1
return start, end

def find_last(a, b):
count = -1
if a == b:
return "0"
elif b == "":
return len(a)
while True:
startpos, endpos = finder(a, b)
if startpos == None:
break
count = count + endpos - startpos
a = a[endpos:]
return count
'''

##what they wrote
def find_last(s,t):
last_pos = -1
while True:
pos = s.find(t,last_pos + 1)
if pos == -1:
return last_pos
last_pos = pos
>>
sup /dpt/, what music do you guys listen to while studying/programming?
>>
>>52388908
>I thought by declaring a float/double it would automatically assume that the values I was using were to be floating point values.
Nah hombre, operator precedence will always say otherwise
>>
>>52386509
Clojure but java-interop can look pretty hairy.
>>
File: CV0AKJgVAAEumxb.jpg (21 KB, 480x260) Image search: [Google]
CV0AKJgVAAEumxb.jpg
21 KB, 480x260
>>52388684
>he can't do complex refactoring backed by a separate static analyzer and also writes boilerplate himself
>>
>>52388977
https://www.youtube.com/watch?v=zscgrDOwUPs
>>
>>52388977
https://www.youtube.com/watch?v=qvwLFUpmXcQ

>2016
>Not listening to comfy background music
>>
>>52389001
>separate static analyzer
>not using a language with a type system expressive enough to do it within the code
Pleb.
>>
>>52386509
C++14
>>
>>52389028
Then obviously your language's type system isn't complex enough to be worth anything
>>
>>52388977
https://www.youtube.com/watch?v=XkU9D0EFQCo
>>
>>52389061
What?
>>
File: 1412923812185.gif (487 KB, 256x190) Image search: [Google]
1412923812185.gif
487 KB, 256x190
>>52388378
Do you know how to read what files exist in a folder/path? The best I can find so far is the following code:

auto a = dirEntries("path",SpanMode.shallow,false);

writeln(a);


But that lists the full paths into some sort of array. I just want file names.
>>
>>52389038
>"->"instead of "."
>beautiful code
>>
>>52388977
https://www.youtube.com/watch?v=rprf7LEraU4
you can't top this
>>
>>52389122
>meme arrows aren't pretty
shiggy mcdiggy
>>
So, I read K&R C, but how should I best update myself for modern C?
Anyone also have any favorite tutorials on shell scripting?
>>
>>52389129
man that's really gay
Are you pulling some memes on us or you for serious?
>>
>>52389186
nice meme
>>
>>52389186
He probably only knows about it because of the GTA V trailers.
>>
just filled out my rolls-royce software dev internship xD

>yfw a reddit tier frog posting meme master is building the control software for the engines on your next flight
>>
>>52388977
https://www.youtube.com/watch?v=Ol7ef92eE6g
https://www.youtube.com/watch?v=ZNpDmKHAjeE
https://www.youtube.com/watch?v=phzNPCfYpzQ
You're welcome.
>>
>>52386154
Learning AngularJS. I touched it two summers ago at an internship and had no idea how it works. It actually makes sense now lol
>>
>>52389246
Do you prefer Blues for the Red Sun or Welcome to Sky Valley
>>
>>52389276
>>>/g/wdg
>>
>>52388601
Here's an example: (architecture dependent, obviously)
#include <stdio.h>

#define TAGPTR(ptr, val) (((unsigned long long)ptr = (unsigned long long)ptr | val))
#define READTAG(ptr) (((unsigned long long)ptr & 15))
#define READPTR(ptr) (((unsigned long long)ptr & 0xFFFFFFFFFFFFFFF0))

int square_or_maybe_cube(int* a)
{
if(READTAG(a) == 0)
{
return *a * *a;
}
else if(READTAG(a) == 1)
{
a = READPTR(a);
return *a * *a * *a;
}
else
return 0;
}

int main(void)
{
int a = 25;
int* ptr = &a;
int* tagged_ptr = &a;

TAGPTR(tagged_ptr, 1);

printf("%d\n", square_or_maybe_cube(ptr));
printf("%d\n", square_or_maybe_cube(tagged_ptr));
}


Squares ptr, but cubes tagged_ptr.
>>
File: IMG_20151209_230220.jpg (35 KB, 469x527) Image search: [Google]
IMG_20151209_230220.jpg
35 KB, 469x527
Why do we like C++ again?
>>
>>52389342
>fast
>fuck tonne of libraries
>very widely used in industry
>statically typed
>OOP

still not a fan of it myself though. it just seems horrific after programming so long in C.
>>
>>52389300
Blues for the Red Sun.
Welcome to Sky Valley has some great songs but the former has just an overall solid foundation and I never get bored of listening to it.
>>
>>52389224
I've never played GTA V
>>
File: 1451754656606.png (17 KB, 418x359) Image search: [Google]
1451754656606.png
17 KB, 418x359
>>52389373
>OOP
Is there a bigger meme?
>>
>>52389342
It's like C, only you get a lot of high-level features such as efficient data structures and decent memory management for free.
>>
>>52387680
I just started an online Verilog class. Ask me again in 7 weeks.
>>
>>52387680
I did some VHDL in college, but that's 5 years ago.
>>
>>52389342
fast and flexible
>>
Just finished my first week of projects for this c++ class

>madlib
>rock paper scissors
>pig game
>>
>>52389241
>internship
>building
>>
Is stuff in the std namespace part of the standard library, or part of the language, or both?
>>
>>52389342
wot? we've pretty much bashed on c++ and java for years.
>>
>>52389435
Java because it's purely OOP
>>
>>52389529
Using namespace std includes the whole standard library so you don't have to type std::cout etc...

It's part of the language
>>
>>52389529
The contents of the standard library is defined in the C++ language spec, but the spec also allows for using C++ without the standard library ("freestanding mode"). So I would not call it "part of the language", even though it is defined in the language spec.
>>
>>52389529
A standard library is by definition part of the language specification.

So technically, both.
>>
>>52389435
>posting normiefrog

back to facebook
>>
File: chip8.jpg (128 KB, 645x651) Image search: [Google]
chip8.jpg
128 KB, 645x651
h-here I go
>>
>>52389694
>OneDrive
nasteh
>>
File: 1401528258010.jpg (71 KB, 268x400) Image search: [Google]
1401528258010.jpg
71 KB, 268x400
>>52389694
>char for byte
>>
>>52389694
>starting with a header file

good luck
>>
>>52389758
>>52389802
>>52389813
keep the (You)s coming lads
>>
>>52389694
>putting all that shit in the header file
>>
whats the /dpt/ aporved online notepad?
>>
>>52389876
>putting all that shit anywhere else
lmao why?
>>
So, this year started with various articles that C should not be used if it can be avoided and C++ still has lots of issues. What is a good, high performance, compiled (or compiler-oriented) programming language that is good to use in the modern world and has at least some library support?
>>
>>52389898
https://codeshare.io/ju9Cl
>>
>>52386215
SJW is a buzzword to discredit things you don't like.
>>
>>52389901
Because it will be linking hell if you include that headerfile more than one place.
>>
>>52389903
dafuq did you hear that from? C++ does not have a lot of issues.
>>
>>52389901
Headers are for things that should be shared. Most of that stuff is VM state, which should only be touched by the VM itself.

If you want to "document" the VM with a header file, package that state up into a struct. Actually, you should do that anyways -- global mutable state should be avoided.
>>
File: plebs vs pats dpt.png (56 KB, 839x777) Image search: [Google]
plebs vs pats dpt.png
56 KB, 839x777
>>52389922
>tfw have to code in java this semester
>>
>>52386181
Vim
>>
https://codeshare.io/h1s7S

anon plz help fix my mistake
i fuqqed up

its html5
>>
>>52389920
nigga it's a chip-8 emulator, I will only be including it once, it's just to keep all the shit away from my main file
>>
>>52386215
ah, the mary poppins school of variable naming
>>
>>52389922

Ok, it's not "this year", I just recently read this one.

https://flyx.org/2014/04/24/cpp_sucks/
>>
>>52386280
I'm using C# at work.

It's nice and shit.
>>
>>52389985
whats that lol
>>
>>52389976
Do you understand why programs should be split into separate files?

Putting shit that should only ever be used in a certain file in a different file is counter-productive.
>>
>>52390025
I like to keep shit neat son
>>
>>52390037
That's not neatness, that's needless fragmentation.

Would you store your writing utensils and stationery on opposite sides of an office? No, you'd put them in the same place.
>>
>>52386331
from the mdsn entry on Random

>The default seed value is derived from the system clock and has finite resolution. As a result, different Random objects that are created in close succession by a call to the default constructor will have identical default seed values and, therefore, will produce identical sets of random numbers.
>>
>>52390052
It is neat lmao, not everything needs to be an exercise in programming idioms
>>
>>52390083
You're an idiot, but carry on if that's how you really prefer things.
>>
>>52390091
I bet you compile and link your code separately too. Absolutely disgusting.

You should move past 1992 and learn modern programming practices.
>>
>>52390085

Pretty nice, you're a good programmer.
>>
>>52390085
thought this was /fit/ my bad
>>
>>52390091
Same to you lel
>>
>>52386483
If you're hard coding things like that then it's harder to test + tune.

"What's the game like if the Vyper Class Destroyer has 15% more speed."

If you hard code then you have to make the edit in code and recompile the game to find this out.

If you load from a file then you just need to edit a text file and reload the game.

Which process is faster?
Which process can be automated more easily?
>>
>>52386509
Idiomatic Python
>>
>>52388566
You don't because Java™ is about readability not compactness.
>>
>>52389953
My university uses C/C++ for the majority of its CS courses, with a handful of exceptions.
>>
>>52386353
?
Thread replies: 255
Thread images: 28

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.