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

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 330
Thread images: 28

File: K&R himegoto waifux2.png (1MB, 1000x1400px) Image search: [Google]
K&R himegoto waifux2.png
1MB, 1000x1400px
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 (108KB, 960x827px) Image search: [Google]
ss1.png
108KB, 960x827px
>>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 (3KB, 3840x2160px) Image search: [Google]
._..png
3KB, 3840x2160px
>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 (124KB, 1024x683px) Image search: [Google]
Yellow_Throated_Marten.jpg
124KB, 1024x683px
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 (180KB, 1024x685px) Image search: [Google]
Greater_Grison.jpg
180KB, 1024x685px
>>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 (85KB, 1024x683px) Image search: [Google]
Fisher_Cat.jpg
85KB, 1024x683px
>>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 (63KB, 800x600px) Image search: [Google]
Least_Weasel.jpg
63KB, 800x600px
>>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 (16KB, 362x479px) Image search: [Google]
book.png
16KB, 362x479px
>>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 (8KB, 125x95px) Image search: [Google]
D.png
8KB, 125x95px
>>52386154
Who D here?
>>
>>52388354
I D here
>>
>>52387353
>making non-owning pointers own things
>>
File: 1451673978244.gif (1MB, 480x357px) Image search: [Google]
1451673978244.gif
1MB, 480x357px
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 (3MB, 1280x720px) Image search: [Google]
1444711551183.webm
3MB, 1280x720px
>>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 (17KB, 418x359px) Image search: [Google]
1451751832808.png
17KB, 418x359px
>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 (21KB, 480x260px) Image search: [Google]
CV0AKJgVAAEumxb.jpg
21KB, 480x260px
>>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 (487KB, 256x190px) Image search: [Google]
1412923812185.gif
487KB, 256x190px
>>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 (35KB, 469x527px) Image search: [Google]
IMG_20151209_230220.jpg
35KB, 469x527px
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 (17KB, 418x359px) Image search: [Google]
1451754656606.png
17KB, 418x359px
>>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 (128KB, 645x651px) Image search: [Google]
chip8.jpg
128KB, 645x651px
h-here I go
>>
>>52389694
>OneDrive
nasteh
>>
File: 1401528258010.jpg (71KB, 268x400px) Image search: [Google]
1401528258010.jpg
71KB, 268x400px
>>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 (56KB, 839x777px) Image search: [Google]
plebs vs pats dpt.png
56KB, 839x777px
>>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
?
>>
>>52389953
>PHP
kek
>>
File: pee pee caught in toaster again.jpg (14KB, 480x179px) Image search: [Google]
pee pee caught in toaster again.jpg
14KB, 480x179px
github:
chewzerita/SBIF
For the teensy 3.1/3.2
I hope I don't get banned for "advertising"
>>
>>52386277
If you don't have 10-level pointer indirection you're a pleb
>>
why is eclipse so fucking complicated? in my old class he just had us use a virtual machine where you just wrote it as a text file with a .cpp and then opened the command prompt and typed g++ filename and it made it into a program. now for this java class i have to fill out millions of option buttons that i don't know the meaning of to try to make a hello world
>>
>>52388977
https://www.youtube.com/watch?v=4LzuZZA9X1g
https://www.youtube.com/watch?v=7EzILj4ASSk
https://www.youtube.com/watch?v=fIml_CAF4-s
>>
>>52386181
as a vim user, emacs.
I use vim because I do a lot of work through ssh sessions on a number of remote servers.
>>
>>52390362
it's really good for JavaEE which would be an absolute nightmare to program without eclipse

I use it for C and python because it's what I'm used. There's probably better options for those tbqh.
>>
Can somebody recommend me a small syllabus of C++ books that would get me ready for making GUI programs in C++? I have experience in Python, C# but none in C++.
>>
>>52390405
learn sdl2
>>
File: screenshot2.png (88KB, 1680x987px) Image search: [Google]
screenshot2.png
88KB, 1680x987px
Hi, new thread!

I'm making progress (despite being lazy af) on my open world shooter (where you can enter every floor of every building)!
I'm thinking about having some like spiderman style swinging mechanics. Just because fuck it I like swinging around in video games.
Might end up making the city destructible too (the way everything is made out of cuboids (or cuboids with cosmetically rounded out corners anyways) would make it really easy to implement).

>TFW I used to have a horrible computer and mostly made Wii homebrew
>everything I did was always designed around what could be done as efficiently as possible
>I actually have a good pc now and I'm not going to bother doing a Wii port
Being able to just waste polygons and not even worry about optimizing stuff until later is THE BEST!

For the person that asked in the previous thread: I'm making it with C++ SDL and OpenGL.
>>
>>52390380
Have you tried TRAMP?
>>
>>52390457
does it have a day/night cycle though?
>>
WARNING: C IS DEPRECATED
>>
how do i make java work with notepad? i can't use eclipse
>>
>>52390362
> why is eclipse so fucking complicated?
It's not just Eclipse; most IDEs are like that.

IDEs are designed for "real" projects, where you have multiple source files, need to link against additional libraries (other than the language's standard library), have multiple targets, and have multiple build configurations.

In that situation, half an hour setting up the project is sod all compared to the months or years the project will last, and hitting F5 (or whatever) to rebuild whatever needs rebuilding is quicker than typing even a single command.

If you're writing toy programs, you should only need to set up the project once then just spend the rest of the semester alternating between editing Test.java and hitting the Rebuild button.
>>
File: 1395637589528.jpg (125KB, 960x935px) Image search: [Google]
1395637589528.jpg
125KB, 960x935px
Can someone point me towards a source on how to read the following code? I don't know how to interpret the 3 lines after the return statement. I'm a Java person trying to pick up some D so that type of syntax isn't natural to me.

string[] listdir(string pathname){
import std.file;
import std.path;
import std.algorithm;
import std.array;

return std.file.dirEntries(pathname, SpanMode.shallow)
.filter!(a => a.isFile)
.map!(a => std.path.baseName(a.name))
.array;
}


The full code is listed below. It reads a pathname and prints all the files (not folders) in a directory.

string[] listdir(string pathname)
{
import std.file;
import std.path;
import std.algorithm;
import std.array;

return std.file.dirEntries(pathname, SpanMode.shallow)
.filter!(a => a.isFile)
.map!(a => std.path.baseName(a.name))
.array;
}

void main(string[] args)
{
import std.stdio;

string[] files = listdir(args[1]);
writefln("%s", files);
}
>>
>>52390620
>there is no middle ground between retyping each command every time and using an IDE
>>
>>52390631
It's the same as
return std.file.dirEntries(pathname, SpanMode.shallow).filter!(a => a.isFile).map!(a => std.path.baseName(a.name)).array;

The "a => ..." parts are lambda expressions.
>>
>>52390631
>get the entries in path name
>only the ones that a files (not directories)
>get the base names of those files
>return them as an array

It's just successive operations on iterable objects.

I don't know D but I expect all the bangs ! are like "doesn't matter if it's empty, just chill and return an empty list early".
>>
>>52389582
> Using namespace std includes the whole standard library
... as well as anything the program added to the std namespace (which is allowed in certain situations, and perfectly possible even where it's not actually "allowed").

It's also a bloody stupid idea, but you probably won't fully realise that until you do it anyhow then try to get the code to compile on a different platform or with a different version of the compiler.

(One place I worked kept around a project which did that, for the sole purpose of giving to new hires who made the mistake of saying "I don't see the problem with using namespace std").
>>
>>52390620
IDE's are a crutch so that idiots can work on "real projects".

>dont learn the language, autocomplete!
>dont learn the language, autocorrect the errors!
>dont learn the tooling, just click play!
>dont learn the linking, just click add reference!
>>
>>52390733
You got it wrong. IDEs are for people who already know the language, compilation tools etc. They just want convenience.

Also, people who say that they don't like IDEs obviously don't know how to turn vim or emacs into an IDE, which makes me vary of their tech related opinions.
>>
>>52390546
QUESTION: HOW?
>>
This is a bit hard to explain... Essentially what i want is something like 7zip. You can either use 7zip file manager and right click items to zip it there, OR you can right click on any item outside 7zip, say a folder in desktop, and have the option of using 7zip. How do i achieve this using a C# application? Can you guys point me in the right direction?
>>
>>52390733
you must still use windows 98 because it's a "truer" operating system
>>
File: screenshot3.png (425KB, 1680x987px) Image search: [Google]
screenshot3.png
425KB, 1680x987px
>>52390477
Not yet, but I'm actually considering it. It isn't a priority for me though.

Might do online multiplayer later too (though if I do I definitely won't be making the environment destructible like it's and either or kinda thing).
>>
how do i increase the size of my text in the command prompt in the newest windows?
>>
>>52390805
Windows is retarded, the only way to do it is to fuck with the registry. Usually, the installer is in charge of doing that -- it has nothing to do with programming the application itself.
>>
>>52390838
make the shooter dude be fucking jacked like a space marine
>>
>>52390860
also hide the navy seal copypasta as an easteregg
>>
How did you guys learn sh scripting?
>>
>>52390838
I'm warning you now that multiplayer is nigh impossible to implement if you put it off. That shit has to go in as soon as possible so that you can build mechanics around it.
>>
>>52390843
Right click on title bar > properties.
>>
>>52390896
https://www.gnu.org/software/bash/manual/html_node/index.html
>>
>>52390926
thanks mate
>>
What would you name this boolean parameter?

 
void setFullscreen(bool XXX) ;
>>
>>52390979
set
>>
>>52390979
fullscreen
>>
how do i go back up a level in windows command prompt when i'm changing directories with cd?
>>
>>52390979
b_booleanParameterToSetFullscreen_ReminderThatThisIsABool
>>
>>52391006
cd ..
>>
>>52390979
setFullscreen(void)

setWindowed
>>
>>52391006
cd..
>>
>>52390979
i'd just remove the boolean and keep a variable remembering the state
>>
>>52391021
>>52391017
no i want to go UP a level
>>
>>52391012
// Translator's Note: Boolean means True or False
>>
>>52391034
It's set full screen not toggle full screen broski
>>
>>52391021
>>52391017
>>52391035
nvm
>>
>>52391035
format /x c:
>>
File: skvIrcR.png (67KB, 1645x486px) Image search: [Google]
skvIrcR.png
67KB, 1645x486px
just fixed my algorithm to install packages/dependencies~ it still ignores version but ill fix that later
image is the results for the following tree:
a {
b { e, ->c },
c { ->d },
d {
f { ->h },
g { ->h }
}
}
>>
>>52390944
I said sh. I don't have bash installed on my system.
I'm not using something as shitty as GNU/Linux.
>>
>>52390660
>>52390684
Thanks anons.
>>
i named my notepad file program.java yet it's showing up int he command prompt as program.java.txt. how do i fix this?
>>
>>52391101
Then reading anything less than SUS would be unworthy of your aspergers.
>>
>>52391156
wow you must be shit at java if you don't know how to unhide extensions
>>
File: Capture.jpg (22KB, 790x127px) Image search: [Google]
Capture.jpg
22KB, 790x127px
>>52391156
>>
>>52391176
it would make since that i'm shit at java seeing as i'm currently trying to compile my first java program
>>
>>52391211
downloading eclipse and using that will probably be a better way to get started

if not, at least download notepad++.
>>
what are techniques to refactor hibernate lazyInitialization of cyclic data ?

by refactoring i mean, how to remove hibernate
>>
>>52386721
colour scheme?
>>
>>52391244
if you read the entire thread you'll be able to discern the chronology of me trying to get eclipse to work
>>
>>52391312
If you need a giant IDE, then Netbeans seemed to just werk when I was forced to do Java labour.
>>
>>52391390
i'm in college taking my first java class
>>
>>52388566
Should work for 1 to 10.
for (int i = 1; i <= 10; i++) {i % 15 == 0 ? System.out.println("Fizzbuzz") : (i % 3 == 0 ? System.out.println("Fizz") : (i % 5 == 0 ? System.out.println("Buzz") : System.out.println(Integer.toString(i))))}
>>
i want to make an anime game

what language and framework should i use
>>
>>52391445
IntelliJ is god tier
>>
File: tired pepe.jpg (20KB, 306x306px) Image search: [Google]
tired pepe.jpg
20KB, 306x306px
>>52391534
>The most intelligent Java IDE
I DONT WANT HELP AUTOCOMPLETING MY CODE AND AUTODEBUGGING I JUST WANT TO BE ABLE TO WRITE MY CODE INTO A FILE AND COMPILE IT AND EXECUTE IT LIKE I DID WITH C++ I'M GOING TO KILL MYSELF REEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
>>
>>52391570
then use vi. I like vi.
>>
>>52391570
Install Gentoo
>>
>>52391570
>DONT WANT HELP AUTOCOMPLETING MY CODE

Yeah, you do. Even emacsfags and vimfags use their fancy autocomplete plugins.
>>
>>52391510
JK ternary don't work like that, try this inside:
for (int i = 1; i <= 20; i++) { if (i % 15 == 0) { System.out.println("Fizzbuzz"); } else if (i % 3 == 0) { System.out.println("Fizz"); } else if (i % 5 == 0) { System.out.println("Buzz"); } else { System.out.println(i); } }
>>
>>52386154
Please stop this programming trap meme.
Thanks.
>>
NEW

>>52391746
>>52391746
>>52391746
>>52391746
>>
>>52390106

Compilation and lining are separate processes, and are still some separately in modern languages. Even Rust does it separately.
Thread posts: 330
Thread images: 28


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.