[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: 23
File: 1456075074460.jpg (60 KB, 627x627) Image search: [Google]
1456075074460.jpg
60 KB, 627x627
Previous thread: >>54927397

What are you working on, /g/?
>>
>>54934593
First for D
>>
>305
Too soon faggot
>>
File: crying-baby-1.jpg (15 KB, 635x414) Image search: [Google]
crying-baby-1.jpg
15 KB, 635x414
>>54934599
>>
why is unit testing is java so inconvenient?
>>
TeamSpeak + Steam integration bot
>>
>>54934597
>muh features!
>>
First for c++ is the best language any disagreement is from wannabe programmers and is just sad
>>

int C = 1;

if (C > C++)
puts("C is bigger");
else
puts("C++ is bigger");

>>
>>54934725
>features now considered a bad thing
>>54934768
first for "C++ is absolutely horrible and anyone who disagrees should be shot" is an accurate representation of your opinion
>>
What language(s) should I learn in order to develop my own cryptocurrency?
>>
>>54934805
So what shitty language do you use my friend let me guess Sanjeef tier Java or maybe you are so l33t you use Python
>>
>>54934805
>he thinks more features are always better
>he thinks C++ is absolutely horrible
IDIOT
>>
>>54934812
Php all you need is php, php is love, php is life
>>
>>54934824
Yes he is mentally handicapped and it is people like him that convince people that they can be programmers because they can learn a syntax
>>
>>54934653
If you think Java Unit Testing is bad, wait till you try the Android+Java testing clusterfuck combo.

Robolectric makes it bearable but it still fucking sucks. It's kinda fun though when you write a beautiful test for a huge blackbox piece of code
>>
File: 1442189860428.jpg (245 KB, 947x1205) Image search: [Google]
1442189860428.jpg
245 KB, 947x1205
I know ruby, rails, and javascript. What should I learn next?! XDDDD
>>
>>54934818
>>54934824
>>54934842

>I can't read
>>
>>54934924
Learn how to use a gun and then shoot yourself.
>>
>>54934924
You should kill yourself because you realise that you are proud of becoming a code-monkey who can use program terribly in some meme languages that even kids can program in
>>
>>54934940
>Learn how to use a gun

They're pretty much idiot proof.
>>
File: cutecat.jpg (198 KB, 960x960) Image search: [Google]
cutecat.jpg
198 KB, 960x960
>>54934940
>>54934954

I actually seriously ask though because I can't tell which languages are memes and which aren't. I just learned these so I could move out to the bay area and make six figs. Some guidance would be nice on what to learn next though. ^_^
>>
>>54935015
What's popular is what's actually used in industry. What's popular is also what low-quality people on 4chan will call a 'meme' in an attempt to de-legitimize it.
>>
>>54935015
Ruby is a trash and unscslable version of python. Use python.
Also: Java > c#
>>
>>54935015
Ok you want my honest opinion if you are serious about programming learn c++ if you have time you may as well learn lisp or ocaml or rust. I mean not much job oppurtunities for that right now but it will help you grow as a programmer
>>
>>54935066
I despise you so much you are advising this young new programmer to learn Java or c#...just cos you are a fuck up doesn't mean he has to be
>>
>>54935015
you seem like a retarded webshit so python
>>
>>54935105
>mad
>internet
>>
>>54934924
html an css?
>>
>>54935116
He is clearly new to programming and probably picked those languages not because he is interested in webshit but because he searches some shit ass site and saw a language he recognises(JavaScript) and then some Redditfag told him to learn Ruby on Rails.

Overall Python is a good first language. But desu more than Python if ur gonna learn a SL learn perl I mean perl is God-tier. Don't even bash perl because you have never used it, perl is life.
>>
>>54935160
he wants a six figure job in the bay area, then python is what he should be learning, not perl
>>
>>54935140
What age are you kid I mean I know you must be under 12 considering you are using a language that is as good as scratch. People like you destroy this industry so yes I am mad at the fact that every 50 year old mother of 5 feminazi thinks she can be the next genius programming mind because she can learn Java ffs
>>
File: 1442874048749.jpg (93 KB, 699x464) Image search: [Google]
1442874048749.jpg
93 KB, 699x464
>>54935116

I just did AppAcademy, so you are correct. If there were a well respected coding bootcamp that wasn't webcentric I would have done that, but it was my foot in the door...

>>54935086

Learn them to what ends? Just because I will be more generally knowledgeable or because there are specific things I need to pick up that are abstracted away in ruby?

>>54935066

I mean I take your word for it, but what makes ruby unscalable and python not?
>>
>>54935173
I can agree with that but if you got some spare time it's good to pick up a few languages that aren't really looked for in jobs just to advance your programming talent. For example a lisp or Haskell or some other functional meme.
>>
File: 1443470280896.jpg (100 KB, 600x825) Image search: [Google]
1443470280896.jpg
100 KB, 600x825
>>54935158

I mean I know HTML/CSS, SQL and React too, I was just speaking to general programming languages.

>>54935173

I already have said job. Just started. I just want to actually become a good programmer and transition from junior web dev.
>>
>>54935194
Python is just usually faster when dealing w big data, etc. Google it cuz I'm lazy. I'd recommend learning both but I like python more. After python & Ruby try Java for knowledge on OOP, from Java, c# is easy
>>
>>54935225
learn java
>>
>>54935194
Using c++ will advance your growth as a programmer and will make you see things in a completely different perspective than ruby. C++ is a low level procedural/templating/OOP language whilst ruby is high level level scripting language they are extremely different from one another. There are some things you simply cannot do efficiently in ruby that you can do in other languages. At the end of the day it is about learning programming theory and picking the right tool for the job that is a measure of your programming ability not just learning syntax
>>
>>54935247
I have never ever seen the words Python and fast being used in the same sentence. Are you smoking crack my friend
>>
>>54935279
it's being compared to ruby which is even worse
>>
>>54934799
desu u dont even need 2 initialize C to anything
>>
>>54935292
Yes I agree ruby is just a slower version of Python that is pointless and meaningless only edgy hipsterfags use ruby
>>
>>54935292
Python is faster than Ruby which is what I mean. Both are reasonably easy languages to learn, especially as a beginner.
>>
>>54935194
>Learn them to what ends? Just because I will be more generally knowledgeable or because there are specific things I need to pick up that are abstracted away in ruby?
Because despite startups paying six figures they last two paychecks because the companies go under in a month.

C/C++/Java is used at established companies that will never disappear like IBM, Microsoft, Redhat, banks, list goes on
>>
>>54935326
I was gonna comment on that same thing but I cannot comprehend how he can basically ask what is the difference between Ruby and other languages. It sounds as if he believes all programming languages are the same and that pisses me off
>>
Ruby's got to have the worst syntax out of all the scripting languages.
>>
>>54935357
*cough*Php*cough*
*cough*perl*cough*
*cough*many other scripting languages*cough*
>>
>>54935368
PHP's syntax is not that bad though, it feels quite natural to write even though the language is garbage itself, I've got to agree on Perl but it's a monster on its own.
>>
so let me bring up another topic of conversation sure to liven things up

Goto statements
>>
>>54935424
>statement based language
Disgusting.
>>
What's your opinion on GNU parallel's syntax?
>>
>>54935301
don't even need anything but the puts("C++ is bigger") since the initial value of C is returned before incrementing.

>>54935356
There is a misconception really that the only metric that differentiates languages is abstraction.

>>54935424
Necessary, but should only be used when there are no other alternatives.
>>
ok guys may as well ask
What is your favourite language, ya know that one language you just feel a warmth inside while programming in
>>
>>54935546
C++
>>
>>54935565
faggot
>>
>>54935569
kys pythonbabby
>>
>>54935565
I agree
Don't listen to
>>54935569
He is clearly a Sanjeef tier programmer
>>
>>54935569
I agree
>>
>>54935597
Tfw samefag
>>
>>54935609
this
>>
>>54935612
kys
>>
>>54935645
you're mom
>>
>>54935645
Tfw one 12 year old pajeet samefag tries to insult the real programmers who don't use meme langs
>>
File: KYS KYS KYS.gif (48 KB, 2034x1491) Image search: [Google]
KYS KYS KYS.gif
48 KB, 2034x1491
>>54935609
KYS
>>
>>54935357
actually consider ending your life
>>
>>54935772
put your trip back on fag
>>
Every post between >>54935565 and this post is either new or under 18
>>
>>54935772
Well that was just rude ...
>>
>>54935831
(And >>54935565 isn't necessarily new or under 18 but is definitely retarded)
>>
>>54935799

>>54935772
is not me.
>>
>>54935842
But >>54935799 is, isn't it?
>>
>>54935842
Yes it was tripcuck kill yourself you fucking attention whoring faggot you actually think anyone gives half a mongolian shit about you you fucking dim witted punk?
>>
Bringing this thread back on topic with a bold statement

JavaScript isn't as bad as people make out
>>
>>54935990
not as bad as python but still really bad
>>
>>54935990
aren't all javascript variables global by default?
>>
>>54935990
Not that bold at all to b h

>>54936024
No, all variables declared without the 'var' qualifier are. It's a gotcha but not a huge deal because linters catch it really easily.
>>
File: FuckingRetards.png (86 KB, 1366x768) Image search: [Google]
FuckingRetards.png
86 KB, 1366x768
Clearing up who is and isn't me.

Anyways, anyone know of any resources on, say, garbage collection algorithms? Like aside from the standard mark and sweep, I'd like to see what modern research has brought us in this area.
>>
>>54936055
Modern research in this area has brought us ARC
>>
>>54936055
>900 millennia in mspaint
not fooling anyone, tripmelt

>I'd like to see what modern research has brought us in this area.
I hear generational GCs are cool
>>
File: The Art Of Trolling.png (85 KB, 1264x904) Image search: [Google]
The Art Of Trolling.png
85 KB, 1264x904
>>54936055
>>
File: nextyoullsay.png (676 KB, 652x711) Image search: [Google]
nextyoullsay.png
676 KB, 652x711
>>54935990
>Javascript is based on Scheme and V8 is really fast
>>
>>54936080
>he is proud of this
kys
>>
fucking hell, learning anything these days takes me quite some time. worse, every time I ask for advice on how to fix my own life, I quickly forget everything I was told

I should really kill myself, I'm far from the guy that used to learn everything fast. being a poor NEET and not young anymore sucks.
>>
Has anyone used Google's PlayN game engine? I'm debating whether to use that or LibGDX.

Both are in Java, use OpenGL, and are crossplatform. Does anyone have experience with either of them?
>>
>>54936149
You shouldn't try to learn too much, you'll just drag yourself down. Take breaks (like weeks if you feel like it) and don't force it.
>>
>>54936175
>High and low-level drawing APIs are provided: write directly to OpenGL, use QuadBatch and our built-in shaders, use Surface for an accelerated Canvas-like API, or use the 2D scene graph
so it's meant for 2d unless you diy it with opengl? i started with libgdx and i regret it, it's better to start from scratch especially when you're learning and you don't need a game engine/framework for 2d, and crossplatform is not hard
>>
>>54936211
>https://github.com/playn/playn
also it's using robovm which microsoft bought up and shut down so i think you'd have to come up with something else for iOS
>>
>>54936185
yeah, but I really want to learn. thing is, I think that learning from books is really the best way to learn, but... they are just too slow. either that, or I simply force myself into reading chapters quickier, but I'm not used to learning/memorizing a shitload of info quickly anymore ;_;
>>
Does anyone have the cs grad meme where they used a drop down box for all phone number options?
>>
File: 1463696945268.png (25 KB, 396x400) Image search: [Google]
1463696945268.png
25 KB, 396x400
If I use a game engine do i avoid all the hassle of opengl/directx calls?

I really can't wrap my head around OpenGL 3.0+ and shaders and shit.
>>
>>54936080
t. 54885630
>>
>>54936321
you avoid them with UE4, cryengine 3 and jewnity but not really with simpler barebones engines like libgdx and playn
>>
>>54936256
Programming shouldn't be about memorizing. Maybe look for a good tutorial online (it's really easy to tell quality apart from shit)? Those go way faster than books and it's easy to copy/paste and tinker with code from them
>>
>>54936064
>>54936067

Thank you for your contributions.
>>
>>54936349
Will I lose any power really if I use UE4/Cry3/jewnity? Do I have to subject myself to some mandated modeling that they accept only?
>>
>>54936295
>>
>>54934593
hello, im retarded.

learning C, i have been for months and occasionally pick it back up. finally getting interested in it, legitimate interest, its going great

anyways i want to know why this doesn't work. comments outline the problem i am having. basically the for loop will work for one number (1) but not for the other (0), even though i use ||. it isn't just 0 either but thats just what i want to use. you will also need to press a number, then enter, then another number for it to work as it has been for me. i don't know why, it just started acting that way after i rewrote it for simplification but i dont see why it should so that is something else if you could help me figure the fuck out would make my day

#include <stdio.h>
int main()
{
int movies;

printf ("Ay yo Rolonda, would you like to go to the movies? Say 1 for yes, and 0 for no. There are no wrong answers. ");
scanf ("%d\n", &movies);

if (movies == 1) {
printf ("Cool, I'll holla at you gurlfrand. ");
}
else if (movies == 0) {
printf ("Aight, I'll holla at you later. ");
}
else {
printf ("O-okay.");
}

/*
the goal of the following line is to attach a single unique line of text to both the answers 1 and 0. it's purpose is to create an example using the for loop in a meaningful way. the problem is this will work for the number 1, but not for the number 0. if you add another number, such as for example 4, it will end at the else statement and also, will not work.
*/
for (movies == (0 || 1); movies == (0 || 1); movies = 2) {
printf ("Tell me if you change your mind.");
}
}


please save me, ive tried to figure it out on my own, but ive spent like eight hours just on this one fucking thing (as in whole page, ive been learning everything through trial and error, literally only thing ive done all day)
>>
>>54936389
Hello retarded
>>
File: sphk.jpg (2 MB, 1748x2480) Image search: [Google]
sphk.jpg
2 MB, 1748x2480
>>54936370
thanks.

have a maki
>>
>>54936321
>>54936349
also you should really learn opengl and shaders it seems really hard at first and it's hard to gather the relevant knowledge with all the autistic documentation and such but it's actually really easy in the end and if you use a game engine you still have to learn a lot about the engine instead of something more general purpose like shaders and graphics programming

>>54936365
you lose performance and you also lose a lot of ability in terms of what you can do. they're only really suitable for typical mainstream games that fit a certain mold like a first/third person shooter with standardized hit detection and physics and such and you just want to customize the storyline and aesthetics. if you want something that doesn't fit the mold you'll still have to do a ton of programming yourself and it's kinda pointless to use an engine at that point
>>
>>54936370
>what is server side page rendering
while it's certainly not the smartest solution, it's not retarded either
>>
>>54936409
s/mold/mould
>>
>>54936393
nice to meet you
>>
>>54936409
also in game engines you can still use your own shaders, it's really useful to know them so you can get the effects you want and do gpu-side programming
>>
trying to go through learn-opengls tutorials but oh my god, im so slow and its so boring. im only in chapter 8 after two weeks of reading this thing and its not that i have learning problems, i just constantly get distracted because im still at a stage i cant build anuthing meaningful with openglbfor practice
>>
>>54936389
I think you need to go over for loops again for what and how they're used
>>
>>54936410
it is 100% retarded. no point in using this over a validated text box input unless you're mentally challenged.
>>
>>54936410
As a user, would you really want to scroll through thousands of numbers to find the correct one?
>>
>>54936477
>As a user, would you really want to scroll through thousands of numbers to find the correct one?
>implying using dropdown menus in the first place is a smart idea
>>
>>54936211
>>54936250
Hmm. Maybe I'll just bite the bullet and learn C++ and OpenGL.

Thanks
>>
>>54936454
how is it not appropriate for this task? the whole goal isn't to do things the most optimally, but to find a purpose for these loops to help me better understand them

it works for example if i do
for (x == (1 || 0); x < 2; x+=2) {
however that only works for numbers that aren't negative. it seems like it should be capable of this job
>>
>>54936520
for loops are for iteration, you're only adding one line of text to one result and your conditions are fucked up

you could just add
\nI suck cocks
in your strings for the 1 and 0 if statements to print on the newline
>>
>>54934593
can we have one thread that you might-makes-rightards don't shit up in the first three posts?
>>
>>54936492
What?

The ridiculous amount of scrolling is the reason that dropdown menus are a bad idea.
>>
>>54936295
>cs grad meme
how come no one has made a website with this? or... does it exist?

>>54936356
afaiu, when you learn, you do a few things, one of which is memorizing the stuff you are learning. then, as you practice, the things you memorized are "internalized" and you can say "I've learned"
>>
>>54936556
That's my point.
>>
>>54936551
>\nI suck cocks
*\n.I suck cocks
>>
>>54936520
for (x == (1 || 0)...


anon, that first part is supposed to assign a value, not make a comparison
>>
>>54936562
That's what I said in the first place though. When did I imply that dropdown menus were a smart idea?
>>
>>54936551
potentially though if i had to do that for 10 or more lines it would be easier to just create a loop

>>54936578
so suddenly that initialization wont fucking work? because in the post youve quoted that was the only example where it correctly served it's purpose to single out the values 1 and 0
>>
>>54936648
or you could just use another if statement at the end

like if you had 1000 responses and didn't want to individually paste in for #s 0-999 you could do
if (movie >= 0 && movie <= 999) {
printf("suck my scrotum");
}


also for loops are structured like
for (var initilization; condition; increment until var meets condition) {
statements;
}
>>
>>54936520
okay, I think I understand what you want. try this

#include <stdio.h>
int main()
{
int movies = -1;

printf ("Ay yo Rolonda, would you like to go to the movies? Say 1 for yes, and 0 for no. There are no wrong answers. ");

while (1)
{
scanf ("%d\n", &movies);

if (movies == 1) break;
else if (movies == 0) printf ("Aight, I'll holla at you later. ");
else printf ("O-okay.");

printf ("Tell me if you change your mind.");
}

printf ("Cool, I'll holla at you gurlfrand. ");

return 0;
}


while loops go until a state is achieved where as for goes a set number of times. break ends a while or for loop abruptly

>>54936713
anon, he's working in C. don't confuse him with nonsense syntax
>>
>>54936648
I think the initialization will still work, but it's "supposed to" be used to create an internal counter variable, not as a conditional.

The fact that it's used for this, plus the way the condition and incrementer are set up such that the loop runs only once makes this an abuse of the for loop.
>>
could anybody who has Windows (32-bit), and any free time help me compile some shit.

No matter what I try, I can never get this hunk of shit computer to compile anything.
>>
>>54935990
it's so not bad that there are like 30 other languages that compile down to it so you don't have to write in it explicitly
>>
>>54936410
>it's not retarded either
yes returning ten thousand lines of select options in a dropdown list rendered on the server is not at all retarded when you can solve the problem with a client side 1 liner I found in 5 seconds on google
<input type="text" onkeypress='return event.charCode >= 48 && event.charCode <= 57' maxlength="4"></input>
>>
I'm doing some work in VHDL, and i've come to a problem. I'm supposed to write a code for reading/writing shit at a registers. Thing is, I declared them as signals, and it seems that i can't read them during simulation. Does anyone know how to fix this? Declarim them as standard ports won't work, given the board I'm working with doesn't have enough I/O ports for it
>>
>>54936863
right click > paste still works when you do it like that though
>>
>Haskell
>Performance

Pick one
>>
>>54937059
I pick performance!

what do I win?
>>
>>54937059
One
>>
>>54937071
You win 1000 years of inexpressive, unsafe & dull unscalable pleb languages
>>
>>54937105
>Haskell
>scalable

Pick one.
>>
>>54934593
>Java
>C++ (and C but not as much)
>C#
>js + all the meme MEAN shit
>some python just coz arduino and raspi shit

Is my skill set any good for real world job ?? What should I learn to be more employebale ?

>I am tall, white, blond with blue eyes and german roots btw, so thats a huge no no on the interviews
>>
>>54937165
You could know 500 different languages/technologies and still be unemployable. What you have done with your skills so far is what matters more.
>>
>>54937143
Scala ripped off Haskell so it stands to reason that Haskell is also Scalable
>>
>>54937105
>You win 1000 years of inexpressive, unsafe & dull unscalable pleb languages
like Go and Rust?
>>
>>54937183
Riight... well I have done 2-3 websites for clients for the last 6 months, and build few "apps" for android that are really simple and just act as a wrapper over the original logic.
Other than that I have 2 games in the making using C++, both are 2D and "indie". But thats not the market I am looking for to dive in, I am doing them with a friend in the free time and we don't care if we fail with the said projects.

So, I guess, I have to work on my portfolio then. Whats best practices ? Should I do some open source project work etc ?
>>
>>54937227
Yes, exactly like Go and Rust
>>
>>54937241
k bro, cool story
>>
>>54934593
okay, jesus, chill out
>>
>>54936555
C U C K
U
C
K
>>
>>54936555
>not wanting to make america great again
>>
>>54937250
wow that drumpf's really scaring me too, glad im not the only one :^)
>>
File: hiddentalent.webm (2 MB, 1280x720) Image search: [Google]
hiddentalent.webm
2 MB, 1280x720
/dpt/-chan, daisuki~

>>54937059
https://code.facebook.com/posts/745068642270222/fighting-spam-with-haskell/

>>54936089
>Javascript is based on Scheme
No.

>>54934653
Static typing.
>>
>>54937389
Why haven't you killed yourself, you attention whore?
>>
>>54937389
good post, I read it
>>
>>54937363
>drumpf

worst maymay ever
>>
>>54937389
image guess for this is floristry? what is the actual sauce?
>>
I wrote a program that monitors ports but, the bittorrent protocol has ports in the same range.

What I'm monitoring is also UDP.
I've tried limiting the ports in deluge but the incoming connections use the same ports or something.
How do I prevent torrent traffic from interfering?
>>
File: 2016.jpg (28 KB, 367x390) Image search: [Google]
2016.jpg
28 KB, 367x390
>>54937465
best meme of CURRENT YEAR
>>
>>54937488
Use a different port.
>>
>>54937503
I can't control the ports, senpai.
>>
>>54937512
>>54937503
>>54937488
I could just add the peers to a list and ignore them, I do not know how to get all of the current peers from deluge.
I only see something /one/ torrent at a time.
>>
>>54937465
>>54937491
>hahaha i can into pol memes

You're literally normies
>>
> OpenSSL
> Notify server about unusable connections from clients
> What method do you suggest?

Blocking or nonblocking? Select? Pings? Timer?
>>
>>54937536

You're right. I'm a Cruz Missile now.
>>
>>54937536
>You're literally normies
you say this like it's a bad thing
>>
>>54937238
i was gonna suggest android/iOS and/or game dev to broaden your skill set and portfolio but it seems you're not interested in those things
>>
>>54937554
It is. You sound autistic as fuck.
It's like fucking r/The_Donald in here
>>
I really like C and wish to do everything in C, but I know that's unrealistic.

How do I get a job where I stay as far away from webdev as possible and just write C all day?
>>
>>54937512
>I can't control the ports, senpai.
UPnP
>>
>>54937565
>normies
>autistic
normies are pathetic in their own way but they're not autistic
>>
>>54937606
Normies meming
>>
>>54937605
>UPnP
>program that monitors ports >>54937488
???
>>
>>54937565
have fun at your bernie rally :v)
>>
>>54937602
write device drivers or something
>>
>>54937602
get a C++ job and write C-style C++
>>
>>54937704
this

>>54937658
I'm tired of you reddit faggots giving /pol/ a bad name.
>>
>>54937729
>reddit faggots
funny that you're the one referencing subreddits here then, huh?
>>
>>54937753
Yeah maybe if you'd actually spent a fucking second on /pol/ you might have heard about literally anything /pol/ related
>>
>>54937771
sorry that I'm not enlightened like you, any tips before I dive deep?
>>
>>54936773
Oh come on.

None of you can help me compile this shit?
>>
File: 1453907886839.jpg (338 KB, 1024x576) Image search: [Google]
1453907886839.jpg
338 KB, 1024x576
I'm bored /dpt/.
What should I make?
Primarily possible with Py.
>>
>>54937794
What is it?
>>
Alright /dpt/, riddle me this: Here we have a simple definition for an object in a scheme interpreter:

enum scm_kind {
SCM_BOOL,
SCM_CONS,
SCM_FIXED,
SCM_FLOAT,
SCM_STRING,
SCM_SYMBOL,
SCM_VECTOR
};

struct scm_cell {
union {
bool as_bool;
ptrdiff_t as_fixed;
double as_float;
struct {
struct scm_cell *car;
struct scm_cell *cdr;
} as_cons;
struct {
char *str;
ptrdiff_t len;
ptrdiff_t cap;
} as_string;
struct {
struct scm_cell *vec;
ptrdiff_t len;
ptrdiff_t cap;
} as_vector;
};
enum scm_kind _kind;
};


We know that because it contains a double precision float as one of the first elements in the union, that it has to be 8-byte aligned on either 32-bit or 64-bit platforms. It thus makes logical sense that it should be 32 bytes total when compiled as 64-bit. But on 32-bit systems, I find that the size of the structure is 24 bytes. A glance at the offsets of each of the members shows a structure something like this:
00    04  08  0C  10   14  18
+-----+---+---+---+----+---+
|bool | | | |kind| |
|fixed| | | |kind| |
|float | | |kind| |
|car |cdr| | |kind| |
|str |len|cap| |kind| |
|vec |len|cap| |kind| |
+-----+----+--+---+----+---+


Notice anything strange? _kind is an enumerated type, and on my machine takes up 4 bytes. But why does it need to be located on an 8 byte boundary? Here we have 8 bytes of wasted code. Something more ideal might look like this:

00    04  08  0C   10
+-----+---+---+----+
|bool | | |kind|
|fixed| | |kind|
|float | |kind|
|car |cdr| |kind|
|str |len|cap|kind|
|vec |len|cap|kind|
+-----+----+--+----+


Here, our double is still 8-byte aligned, so it shouldn't cause issues for any reasonable CPU architecture... at least not Intel, for which this is compiled.
>>
>>54937784
>You should already hate Canadians by this point
>"Really makes you think" isn't actually spam
>90% of sliding isn't actually sliding, just shitposting
>Janitors will ban you for replying to rolls & "reply _ else _"
>Always respond to bait
>Never take "aus/pol/" seriously
>Don't just post memes completely out of place (see >>54937796 )
>"Not an argument" is always an argument
>Ron and Rand Paul are GOAT. Carson is also GOAT
>Calling Trump "God Emperor" is cringe autism
>90% of /pol/ are newfags
>/pol/ is actually a Christian board. Catholics are not Christian
>Ghost/TCR and alex jones/infowars are GOAT
>Sage "alt-right" threads. Sage TRS threads. Sage Milo threads. Sage Sargon threads. Sage and report interracial threads. Sage r9k threads.
>Carlos is funny except when he isn't
>ignore >politics posters
>Fuck turks
>>
I just came back from a furry convention after being dragged there by some friends who are fursuiters.

I haven't touched a computer in 5 days.
What should I program?
>>
>>54937808
it's a lua GLFW binder.

I feel like an ass because I haven't been able to compile it. I need help.
>>
>>54937869
what OS are you on?
>>
>>54937886
Windows 10, obviously
>>
>>54937869
I posted a mene because of OP image.
>>
im trying to write a messaging program
this is what i have so far:
#include <iostream>
#include <stdio.h>
#include <stdlib.h>

using namespace std;

int main(int argc, char* argv[])
{
char mode;
cout << "Enter 'C' for client or 'S' for server\n";
mode = getchar();
if(mode == 'C' || mode == 'c')
{
cout << "Entering client mode...\n";
}
else if(mode == 'S' || mode == 's')
{
cout << "Entering server mode...\n";
}
else{
cout << "Invalid input\n";
system("pause");
}
return 0;
}

is this good or am i retarded?
i would like honest criticism because i'm somewhat new to c++
t. former java pajeet
>>
>>54937940
well it does what you'd expect it to do
>>
>>54936370
>not using php
>>
>>54937940
Lol idk, I just used visual studio and dragged and dropped some modules together
>>
>>54937940
looks great, just use getchar() instead of system("pause"), the pause version is actually a security vulnerability
>>
>>54937940

Don't use system("pause"). Don't use getchar() to pause the program either as Anon is suggesting. Your program should terminate as soon as it has nothing else to do.

And I know what you're going to say next...

"But the window will close before I can see the results of my program"

You're running it wrong. Aside from the fact that Visual Studio can already insert the pause for you by running your program on a script like this:

your_program some args here
pause


If you are running it anywhere outside of debugging you would know that console programs are run... from a console. If you are using cmd or powershell or cygwin or msys bash to run your program, it's not going to open up a new window, print shit out, and close it. It's going to run the program using its own window to print the output, and when the program has finished, it's going to return execution to the shell you called it from. That's the way console programs are supposed to be run.

So just stop. Let your program terminate, and never ever for the rest of your life add system("pause") or anything similar at the end of your program. It's completely unnecessary.
>>
Terminal based OSes were a mistake
>>
>>54937954
>>54937973
>>54937977
>>54938058
thanks for the feedback, i'll probably post a bit more here about sockets and stuff once i get to that point
>>
>>54938083
no
>>
>>54938083
Operating systems were a mistake
>>
>>54938083
You were a mistake
>>
>>54937839
https://ideone.com/CrqV0Z
>>
>>54937839
What OS and text editor do you use>
>>
Best programming languages?

top tier:
>Excel Formulas
>MSWLogo
>C preprocessor
>.txt

good tier
>C derivatives (C++, Go, D, ...)
>ML derivatives (Ocaml, F#, ...)
>Powershell

ok tier
>meme languages (Nim, Idris)
>English language

diaper tier
>visual basic
>C#
>x86, x64 assembly
>bash

web tier
>HTML
>CSS

python tier
>python
>javascript
>python
>java
>python
>>
Hi /dpt/, friend and I need an idea for an Android application to pass the Android class.
We have until this Wednesday to finish it.
Any ideas?
>>
>>54939026
Calculator

everyone does it
>>
/ded/pt/
>>
>>54935279
PyPy
Cython
Numba
>>
>>54935990
I agree. Spergs are just angry at node.js for some reason
>>
>>54938995
kill yourself
>>
>>54939026
fucking retard if you want an app in two days just do some bullshit like a calculator why are you even asking for ideas stop procrastinating idiot
>>
>>54937871
Program a furry tamagotchi.
>>
>>54939291
Because Im riding a train and am bored
>>
>>54939335
you should be googling for prefab shit like cordova so you can get some junk to present, do you have any idea how much in a hurry you are

you could make tic tac toe or even rock paper scissors if you think you can get away with it
>>
File: Untitled4092.png (78 KB, 1920x1080) Image search: [Google]
Untitled4092.png
78 KB, 1920x1080
This stuff again
>>
>>54939593
>all that wasted space
>>
>>54939610
The zone info (SOA record information) and the Actions panel is still missing.
I had to start somewhere.
>>
>>54939375
We mostly have all the necessary knowledge since all the lectures are over, we just couldn't come up with anything that isn't a calculator and doesnt require online databases because fuck setting up JSON.
>>
>>54936149
how old are you
>>
File: tqdm.gif (469 KB, 720x464) Image search: [Google]
tqdm.gif
469 KB, 720x464
What is he using this gif?
it looks like he is in python console
but how come he has autocompletion and other shit?
>>
>>54938995
Bait: the post.
>>
>>54940020
bpython from the looks of it. its like ipython
>>
>>54940020
tqdm is a cli downloadbar tool for python that shows progress of shit (in that gif case, the range 0-1000 with a sleep)
>>
>>54940310
I know
question was about the environment he is using to show it off
>>
>>54938995
What are the criteria for something to be a "meme language"?
>>
hey can someone here make a browser extension to change the words "desu" back to "desu" and "senpai" back to "senpai" on 4chan plus any other filtered words? sick of reading this weeb shit
>>
>>54940358
email hiroshima or on /qa/ or whatever

that's how cuck got unfiltered
>>
>>54940358
oops. second quotes were "tbqh" -q and "family" -ily
>>
>>54940358
That shit is better than your nigger talk.
>>
>>54940415
post ironic nigger memes are way funnier than weeb shit
>>
>>54940358
desu is already desu and senpai is already senpai
>>
Did anyone work with FUSE? I'm wondering how easy it would be to make a CIFS -> FAT32 bridge.
>>
>>54936051
>using a dynamically-typed language and then relying on linters to catch errors before run time
I don't understand you people.
>>
c++:
I have a regular std::vector of pointers to objects, I clean these up in the destructor. But how do I clean that shit up after a crash or force quit?
>>
>>54937565
cuck pls go
>>
>>54940691
Most resources will be cleaned up automatically when the application ends, no matter what. Otherwise, you need a way of catching the error (usually using exceptions) and then terminating after cleaning up yourself.

Don't take this as an excuse for letting your memory run wild. Memory leaks are still a big issue if you have a program that needs to run continuously, not closing a file handle means you won't be able to write, move, or delete it until the entire program terminates, etc.
>>
>>54940691
operating system frees it when the application stops existing
>>
>>54940580
if you're on windows, check out Dokan
>>
File: r don.png (134 KB, 312x586) Image search: [Google]
r don.png
134 KB, 312x586
>>54940691
Make sure your program never crashes forcefully

>>54940701
Did I insult your favourite subreddit?
>>
>>54940793
Not Windows. It's basically Beaglebone Black USB->whatever. The Beaglebone Black needs to show a FAT32 file system to whatever, with the content from my CIFS server. I thought it was going to be as easy as making symlinks, but then my brain turned on and I realized that I needed to get the data "into" the FAT volume.
>>
>>54936587
Actually you don't... My bad.
>>
>>54940580
>>54940864
Now that I think about it, I don't even think FUSE will help me with this. I'll probably have to fuck around with the g_multi kernel module just to be able to do this properly.
>>
>>54938995
Excel formulas are pretty tight.
Check out this beauty
{=SUM(IF(FREQUENCY(IF(G2:G17<>"", MATCH(G2:G17,G2:G17,0)),ROW(G2:G17)-ROW(G1)+1),1))}
>>
Best language/framework for a small platform independent desktop program that uses some graphical specials like transparent background and always in foreground? No Java or other stuff that rely on heavy dependency.
>>
Reminder that rust is the best language there is, bar none. When rusti grows up some, it will even be the best scripting language around.
>>
>>54941395
Weak bait.
>>
>>54941407
Butthurt
>>
>>54941395
>no higher kinded types
>no polymorphic recursion
>no programmable move semantics
>>
>>54941424
No, just older than 16.
>>
c++:
if I do this:
Obj *objects[MAX_OBJECTS];


What do it initialize as? Full of nullptr?
>>
>>54941477
Yes.
>>
>>54941467
>no higher kinded types
False
>no polymorphic recursion
False
>no programmable move semantics
Effectively the exact opposite

Gratz.
>>
>>54941477
No.
>>
>>54941477
Maybe
>>
>>54941395
make a rust garbage collector please
>>
>>54941505
>False
Use them for me, then.
>False
Literally there isn't. Do you know what polymorphic recursion is?
>Effectively the exact opposite
Every move is a straight memcpy, nothing else.
>>
What's the best book to learn ISO C? And I mean actual ISO C. I already "know" C, but I'm tired of never being 100% sure of whether or not I'm accidentally using undefined/unspecified behaviour in my program. Is there a condensed version of the standard without all the cruft?
>>
Assembly language is the most American and uncucked language of all time. Prove me wrong /g/.
>>
>>54942008
>What's the best book to learn ISO C?
The standard

>Is there a condensed version of the standard without all the cruft?
The standard is already condensed.
>>
>>54942053
>unbounded freedom provided by assembly
You bet your ass it is
>>
>>54942067
>The standard is already condensed.
The standard is a trillion pages long and somewhat dense to read.
>>
>>54942008
definitively c primer plus
>>
>>54942090
>a trillion pages
It's 570 pages cover to cover. Leave out index, table of contents etc, and most of the appendices, it's less than 300 pages.
>>
>>54942150
"C Primer Plus is a book by Stephen Prata meant for beginners to the C programming language." from Wikipedia

Doesn't really seem to be what I'm looking for?

>>54942166
It's still a dense text. If no one has any better suggestions, I'll just read the damn thing.
Thread replies: 255
Thread images: 23

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.