archived
stringclasses
2 values
author
stringlengths
3
20
author_fullname
stringlengths
4
12
body
stringlengths
0
22.5k
comment_type
stringclasses
1 value
controversiality
stringclasses
2 values
created_utc
stringlengths
10
10
edited
stringlengths
4
12
gilded
stringclasses
7 values
id
stringlengths
1
7
link_id
stringlengths
7
10
locked
stringclasses
2 values
name
stringlengths
4
10
parent_id
stringlengths
5
10
permalink
stringlengths
41
91
retrieved_on
stringlengths
10
10
score
stringlengths
1
4
subreddit_id
stringclasses
1 value
subreddit_name_prefixed
stringclasses
1 value
subreddit_type
stringclasses
1 value
total_awards_received
stringclasses
19 values
True
berlinbrown
null
I hate that everyone uses the gang of four patterns as if those are the only patterns.
null
0
1318971269
False
0
c2sj9sd
t3_lg6ms
null
t1_c2sj9sd
t3_lg6ms
null
1427749877
7
t5_2fwo
null
null
null
True
[deleted]
null
The "volatile" keyword means "something other than the code can change the value of this variable, so the optimizer can't assume that it will be constant even if the code doesn't modify it." Option 1: int done = 0; while( !done ) do_stuff(); Option 2: volatile int done = 0; while( !done ) do_stuff(); ...
null
0
1318971283
False
0
c2sj9vh
t3_lgjhl
null
t1_c2sj9vh
t1_c2si1dq
null
1428192075
25
t5_2fwo
null
null
null
True
otakucode
null
The most important thing to remember about Java: If Microsoft does it the way, it doesn't matter how much sense it makes, Java WILL do it differently. It's less pronounced now, but especially in the beginning it was downright comical (in a 'jesus christ I'm going to cry' way). They just couldn't STAND using the same...
null
0
1318971326
False
0
c2sja4r
t3_lg1xx
null
t1_c2sja4r
t1_c2sf60x
null
1427749880
6
t5_2fwo
null
null
null
True
otakucode
null
It's important for people looking at things from a specific perspective. If you understand things from the bottom-up and have experience with assembler, C, C++, then onwards to other languages, it is beneficial to understand just HOW things are being done. The difference between stack and heap used to be very importa...
null
0
1318971331
False
0
c2sja58
t3_lg1xx
null
t1_c2sja58
t1_c2sgbj2
null
1427749880
1
t5_2fwo
null
null
null
True
ysangkok
null
That's not "only" if you ask me, and I'm sure I'd remember it if it was that much. I grew up with a land-line too. Tell me your location and experiences please, maybe it just works better where I am.
null
0
1318971359
False
0
c2sjab1
t3_lg6ms
null
t1_c2sjab1
t1_c2sj9ft
null
1427749882
2
t5_2fwo
null
null
null
True
optomas
null
>CVS? Seriously? :)| I know. = \ Github looks cool and all ... seems kind of like masturbating in public though. I'd be embarrassed if anyone saw my tiny little code. cvs keeps the clutter confined to one machine and keeps me from doing anything stupid with old code. At least, anything irrecoverably stupid. M...
null
0
1318971513
False
0
c2sjb4z
t3_lfblq
null
t1_c2sjb4z
t1_c2sflok
null
1427749899
-1
t5_2fwo
null
null
null
True
zzyzzyxx
null
> Arrays in C are weird constructs with all kinds of special and arcane rules about when they do and don't decay into proper, easy-to-understand pointers I'm going from memory so I could be wrong, but I'm pretty sure there are only 3 cases when the an array *doesn't* decay to a pointer: when `&` or `sizeof` are...
null
0
1318971610
False
0
c2sjbpt
t3_lgfp0
null
t1_c2sjbpt
t1_c2sh57h
null
1427749904
7
t5_2fwo
null
null
null
True
[deleted]
null
I've never had a land line (not even growing up!) so I have no idea. I just don't think you can compare a statistic with a single person's experience. Stats just don't work that way.
null
0
1318971636
False
0
c2sjbu2
t3_lg6ms
null
t1_c2sjbu2
t1_c2sjab1
null
1427749905
0
t5_2fwo
null
null
null
True
multivector
null
> (even if you factor in the fact that partial[ly applied] functions would not have been part of my mental toolset) Don't underestimate that factor. Once I learned about function currying I started seeing opportunities to use it all over the place (and I'm afraid I also wrote some petty bad code before I learned wh...
null
0
1318971670
True
0
c2sjc13
t3_lfm1k
null
t1_c2sjc13
t1_c2segjl
null
1427749917
3
t5_2fwo
null
null
null
True
zzyzzyxx
null
No kidding. I assumed 8 because it was a declared to be a 64-bit system and `sizeof(int)` was not specified. My answers would have been right were this the case. Still, I probably should have assumed 4, as that's the most common implementation.
null
0
1318971728
False
0
c2sjce2
t3_lgfp0
null
t1_c2sjce2
t1_c2siesu
null
1427749914
12
t5_2fwo
null
null
null
True
tibbe
null
> Ironically, even though it's often said that FP makes it easier to reason about programs, in reality, an average Go program is much easier to reason about. Why is that? The main benefit of reasoning in FP is that reasoning is local i.e. the result of a function depends only on its arguments. Go seems no different...
null
0
1318971788
False
0
c2sjcqq
t3_lfm1k
null
t1_c2sjcqq
t1_c2sdwo5
null
1427749920
5
t5_2fwo
null
null
null
True
i8beef
null
You... I... never mind. You obviously don't have a good enough grasp of the subject matter to really continue this. LoD has nothing to do with what we are talking about, it's meant to ensure that your calling class doesn't have any knowledge of the IMPLEMENTATION below it's first order dependencies (It doesn't know abo...
null
0
1318971793
False
0
c2sjcrn
t3_lf1px
null
t1_c2sjcrn
t1_c2siyoj
null
1427749921
2
t5_2fwo
null
null
null
True
raydeen
null
No go on my ol' Dell (ATI x1400 card). Will have to try the work MacBook. Ran on the MacBook. Kinda neat.
null
0
1318971807
True
0
c2sjcu7
t3_lg6zg
null
t1_c2sjcu7
t3_lg6zg
null
1427749922
0
t5_2fwo
null
null
null
True
MarshallBanana
null
I doubt any modern compiler does anything at all with `register`, except through extensions like gcc's `register asm()`.
null
0
1318971826
False
0
c2sjcxn
t3_lgjhl
null
t1_c2sjcxn
t1_c2si1dq
null
1427749923
3
t5_2fwo
null
null
null
True
elperroborrachotoo
null
[*cough*](http://en.wikipedia.org/wiki/64-bit#64-bit_data_models)
null
0
1318971840
False
0
c2sjczu
t3_lgfp0
null
t1_c2sjczu
t1_c2shygc
null
1427749924
2
t5_2fwo
null
null
null
True
MarshallBanana
null
If you actually want an unsigned int that is the same size as a pointer, use `uintptr_t` from `stdint.h`. This is the only way to do this that actually works reliably.
null
0
1318971928
True
0
c2sjdgp
t3_lgjhl
null
t1_c2sjdgp
t1_c2sievn
null
1428192071
14
t5_2fwo
null
null
null
True
[deleted]
null
It's only with a bit of distance that I realize how big a difference the school makes to the standard of a degree. I would hire someone with a mid-range GPA from Brown or Stanford before someone with a high GPA from my old school (e.g. me).
null
0
1318972132
False
0
c2sjejj
t3_k21i7
null
t1_c2sjejj
t1_c2h8zdn
null
1427749938
1
t5_2fwo
null
null
null
True
elperroborrachotoo
null
I found that almost intentionally misleading because a 64 bit system was pointed out without need - only a linear address space large enough to hold x is relevant to the question. OTOH explicitely mentioning sizeof(int) or using an uncommon type such as int32_t would have suggested this plays a role in the answer, re...
null
0
1318972154
False
0
c2sjenu
t3_lgfp0
null
t1_c2sjenu
t1_c2shfrc
null
1427749941
6
t5_2fwo
null
null
null
True
MarshallBanana
null
I am fairly sure that most every compiler ignores the existence of `register`. This is as it should be. `volatile` is a whole other story, though.
null
0
1318972173
False
0
c2sjeto
t3_lgjhl
null
t1_c2sjeto
t1_c2si573
null
1427749946
12
t5_2fwo
null
null
null
True
elperroborrachotoo
null
I found that almost intentionally misleading because a 64 bit system was pointed out without need - only a linear address space large enough to hold x is relevant to the question. OTOH explicitely mentioning sizeof(int) or using an uncommon type such as int32_t would have suggested this plays a role in the answer, re...
null
0
1318972225
False
0
c2sjf3c
t3_lgfp0
null
t1_c2sjf3c
t1_c2shfrc
null
1427749949
1
t5_2fwo
null
null
null
True
zztraider
null
Eh. Tabs are amazing as they are. The frustrating thing about them in VS is that Ctrl+Tab (and Ctrl+Shift+Tab) don't have the same behavior I'm used to from browsers. That is, in VS, if you hit Ctrl+Tab twice, you end up in the same document you started in, regardless of how many tabs there are. In most (all?) browser...
null
0
1318972235
False
0
c2sjf56
t3_lgecn
null
t1_c2sjf56
t3_lgecn
null
1427749949
3
t5_2fwo
null
null
null
True
abdullak
null
That's still inaccurate. This is a WebGL demo.
null
0
1318972258
False
0
c2sjf9r
t3_lg6zg
null
t1_c2sjf9r
t1_c2sg92y
null
1427749950
7
t5_2fwo
null
null
null
True
MarshallBanana
null
Indeed, that confirms what I just said. Are you feeling OK, though? Do you need some water?
null
0
1318972275
False
0
c2sjfe2
t3_lgfp0
null
t1_c2sjfe2
t1_c2sjczu
null
1427749951
2
t5_2fwo
null
null
null
True
[deleted]
null
How would a tiny window showing a tiny part of the source code of a file help me identify tabs more quickly? It wouldn't. And I'm not even talking about navigation yet. There is more to read, it will take even longer than before because it's two stimuli. (name + preview). It will take even more space, which I absolutel...
null
0
1318972278
False
0
c2sjff7
t3_lgecn
null
t1_c2sjff7
t3_lgecn
null
1427749951
3
t5_2fwo
null
null
null
True
how_gauche
null
Johan Tibell gave a long talk at 2010's CUFP about performance in Haskell. The slides are online. Unfortunately it's only a starting point, and many of the tricks of the trade are scattered to the four winds. We've been talking about writing a longer-form book or guide about this. The core principles boil down to this...
null
0
1318972307
False
0
c2sjflm
t3_lfm1k
null
t1_c2sjflm
t1_c2sfkj9
null
1427749952
3
t5_2fwo
null
null
null
True
Tristanus
null
Well on 16bit systems int should be 2 bytes with long being 4 bytes. 32bit systems usually have int as 4 bytes with long also being 4 bytes, int is usually the same size on 64bit systems, but long can differ in size depending on if you're using Windows or Linux, which is a bit annoying, but then again you should proba...
null
0
1318972317
False
0
c2sjfnc
t3_lgfp0
null
t1_c2sjfnc
t1_c2sitfg
null
1427749954
3
t5_2fwo
null
null
null
True
Isvara
null
> "BUT YOU SAID IT WAS A 64-BIT SYSTEM!!" ... which means that *pointers* are 64-bits wide. But you are right that sizeof(int) was undefined.
null
0
1318972325
False
0
c2sjfos
t3_lgfp0
null
t1_c2sjfos
t1_c2siynb
null
1428192068
27
t5_2fwo
null
null
null
True
newgre
null
Most systems? Windows uses LLP64, so by raw numbers, I'm pretty sure that most systems actually use LLP64.
null
0
1318972331
False
0
c2sjfq6
t3_lgfp0
null
t1_c2sjfq6
t1_c2sh88q
null
1428192069
1
t5_2fwo
null
null
null
True
curien
null
`sizeof(int32_t)` could be 4, 2, or 1. He could have made it an array of `char`, and that would have been unambiguous.
null
0
1318972338
False
0
c2sjfrr
t3_lgfp0
null
t1_c2sjfrr
t1_c2sifmr
null
1427749956
5
t5_2fwo
null
null
null
True
tibbe
null
> And people wonder why Haskell is hard to learn or get decent at? There are things in Haskell that are hard to learn, but this isn't one of them. However, we might not be doing a good job teaching these things. To get good performance out of your Haskell program (or C program) the main thing you should be worryin...
null
0
1318972461
True
0
c2sjgdr
t3_lfm1k
null
t1_c2sjgdr
t1_c2sdvkq
null
1427749971
8
t5_2fwo
null
null
null
True
aaarrrggh
null
Am I the only person who actually finds the material on here to be quite dense and hard to absorb? From a design point of view it looks great, but I find the content quite hard to understand.
null
0
1318972536
False
0
c2sjgsb
t3_lg6ms
null
t1_c2sjgsb
t3_lg6ms
null
1427749979
2
t5_2fwo
null
null
null
True
tibbe
null
You don't have to worry about the assembly level. You need to worry about memory layout, just like in any other language.
null
0
1318972606
False
0
c2sjh5d
t3_lfm1k
null
t1_c2sjh5d
t1_c2sf33c
null
1427749987
5
t5_2fwo
null
null
null
True
MarshallBanana
null
> but then again you should probably be using system specific typedefs that more obviously illustrate size of types if you're interested. No, you should be using `stdint.h` which is not system-specific.
null
0
1318972632
False
0
c2sjham
t3_lgfp0
null
t1_c2sjham
t1_c2sjfnc
null
1427749984
9
t5_2fwo
null
null
null
True
freedoodle
null
Your hippocampus is hard wired to react to stimulus, not semantic information. The more visual cues you have, the stronger the response to spatial memory. Space is something that can be collapsed. Months of data recorded developer data would show that you rarely focus on 100s of files at once. If you did, it would b...
null
0
1318972644
False
0
c2sjhcs
t3_lgecn
null
t1_c2sjhcs
t1_c2sjff7
null
1427749987
1
t5_2fwo
null
null
null
True
MarshallBanana
null
Not on any system actually in use.
null
0
1318972682
False
0
c2sjhka
t3_lgfp0
null
t1_c2sjhka
t1_c2sjfrr
null
1427749989
10
t5_2fwo
null
null
null
True
rlbond86
null
If you really know C, you know that sizeof(int) is unspecified.
null
0
1318972684
False
0
c2sjhkn
t3_lgfp0
null
t1_c2sjhkn
t1_c2shygc
null
1427749989
3
t5_2fwo
null
null
null
True
curien
null
>we'll never see a new architecture with a C compiler in which int is not 32 bits. The bit-width is completely different from the byte-width. In C, CHAR_BIT can be larger than 8, and on embedded systems it often is (e.g., there are DSPs where ints are 32-bit, and sizeof(int) is 1).
null
0
1318972686
False
0
c2sjhkx
t3_lgfp0
null
t1_c2sjhkx
t1_c2sj44d
null
1427749989
8
t5_2fwo
null
null
null
True
Tristanus
null
>stdint.h Only available where c99 is, so using it in combination with your typedefs is fine.
null
0
1318972801
False
0
c2sji7a
t3_lgfp0
null
t1_c2sji7a
t1_c2sjham
null
1427750000
4
t5_2fwo
null
null
null
True
doomchild
null
I'll definitely agree that the distinction between stack and heap is important in lower-level languages. The problem is that it *isn't* particularly important in C#, which is what this FAQ purports to describe. And, in fact, there are times when stack-allocated objects get put on the heap for various reasons, so you ...
null
0
1318972808
False
0
c2sji8e
t3_lg1xx
null
t1_c2sji8e
t1_c2sja58
null
1427749996
1
t5_2fwo
null
null
null
True
freedoodle
null
I think you've made my point. Your working memory is focused on what you're doing in code, not the name of the file you're doing it in. There is often nothing associating the name of the file you're working on and the region of code you're in. This is why no associative memory is every formed. For example, if you us...
null
0
1318972811
False
0
c2sji8y
t3_lgecn
null
t1_c2sji8y
t1_c2sjf56
null
1427749996
1
t5_2fwo
null
null
null
True
MarshallBanana
null
I'd say use it anyway, and hack together a replacement one if you ever need to build on a horrible compiler.
null
0
1318972983
False
0
c2sjj5l
t3_lgfp0
null
t1_c2sjj5l
t1_c2sji7a
null
1427750007
7
t5_2fwo
null
null
null
True
MarshallBanana
null
Yes, that is an entirely orthogonal fact. If you know C, you know both of these.
null
0
1318973021
False
0
c2sjjcm
t3_lgfp0
null
t1_c2sjjcm
t1_c2sjhkn
null
1427750013
1
t5_2fwo
null
null
null
True
tugs_cub
null
In today's world, C programmers write for hardware from yesterday's world.
null
0
1318973026
False
0
c2sjjdg
t3_lgfp0
null
t1_c2sjjdg
t1_c2shyl6
null
1427750013
4
t5_2fwo
null
null
null
True
w_daher
null
Yeah, my point in mentioning the 64-bit system was a way of explaining "Oh, that's why the pointer is so large". (But in retrospect, that's pretty obvious.)
null
0
1318973027
False
0
c2sjjdn
t3_lgfp0
null
t1_c2sjjdn
t1_c2sjenu
null
1427750013
5
t5_2fwo
null
null
null
True
bonafidebob
null
445 slides on understanding why the code you've now got to improve or maintain is blowing up.
null
0
1318973028
False
0
c2sjjdp
t3_l6yn1
null
t1_c2sjjdp
t1_c2qcfkc
null
1427750013
0
t5_2fwo
null
null
null
True
psygnisfive
null
Replace "Written in Haskell" with "Written in C" and it would *still* be true.
null
0
1318973069
False
0
c2sjjlw
t3_lfm1k
null
t1_c2sjjlw
t1_c2sizgc
null
1427750016
1
t5_2fwo
null
null
null
True
curien
null
xp1 = X; xp2 = X+1; xp3 = X+2;
null
0
1318973116
False
0
c2sjjv8
t3_lgfp0
null
t1_c2sjjv8
t1_c2sj13y
null
1427750018
3
t5_2fwo
null
null
null
True
[deleted]
null
[deleted]
null
0
1318973148
False
0
c2sjk0t
t3_lg6ms
null
t1_c2sjk0t
t3_lg6ms
null
1427750021
-1
t5_2fwo
null
null
null
True
MarshallBanana
null
Very few do.
null
0
1318973188
False
0
c2sjk8r
t3_lgfp0
null
t1_c2sjk8r
t1_c2sjjdg
null
1427750023
-3
t5_2fwo
null
null
null
True
curien
null
You're wrong, plenty of embedded systems work that way. But even if you were right, you can't see the future.
null
0
1318973235
False
0
c2sjkh9
t3_lgfp0
null
t1_c2sjkh9
t1_c2sjhka
null
1427750025
5
t5_2fwo
null
null
null
True
[deleted]
null
That's all nice and well, but it just doesn't work. But sure, please don't believe me. Develop it as an addon and try to sell it.
null
0
1318973347
False
0
c2sjl3a
t3_lgecn
null
t1_c2sjl3a
t1_c2sjhcs
null
1427750032
1
t5_2fwo
null
null
null
True
JulianMorrison
null
Surely the non-pathological answer is "please don't do that".
null
0
1318973420
False
0
c2sjlgd
t3_lgfp0
null
t1_c2sjlgd
t3_lgfp0
null
1427750035
12
t5_2fwo
null
null
null
True
MarshallBanana
null
Such as?
null
0
1318973436
False
0
c2sjlis
t3_lgfp0
null
t1_c2sjlis
t1_c2sjkh9
null
1427750040
5
t5_2fwo
null
null
null
True
jwaters
null
I've used it for a project recently. Here's the issues I ran into; caveat that this was the first time I've ever used SSB: * Required the use of certificates. Certs shouldn't be a big deal in this day and age, but it was a complexity factor; SQL has its own management mechanism for certs, independent from the OS cert...
null
0
1318973447
False
0
c2sjll3
t3_lff3n
null
t1_c2sjll3
t1_c2sg44l
null
1427750036
1
t5_2fwo
null
null
null
True
losmaxos
null
congrats!
null
0
1318973470
False
0
c2sjlpo
t3_lbywd
null
t1_c2sjlpo
t1_c2rj7fj
null
1427750038
1
t5_2fwo
null
null
null
True
cojoco
null
> there are DSPs where ints are 32-bit, and sizeof(int) is 1 That sounds interesting. What is sizeof(char) on such architectures? Do you have a reference to such a thing? Thanks.
null
0
1318973482
False
0
c2sjlso
t3_lgfp0
null
t1_c2sjlso
t1_c2sjhkx
null
1427750038
4
t5_2fwo
null
null
null
True
FoolishClownfish
null
I believe the 20% number, mainly because there are always a lot of improvements that can be made to a body of code (especially v1) that will make maintenance easier in the future.. I would also postulate a corrolary **"If none of the original authors of the code are available, it is better to rewrite from scratch"** ...
null
0
1318973508
False
0
c2sjlwu
t3_ldgye
null
t1_c2sjlwu
t1_c2sj7j9
null
1427750040
1
t5_2fwo
null
null
null
True
ysangkok
null
When it's an unsourced claim like this one against my experiences, and we aren't just talking about an off-by-one, I'm gonna go and trust my own experiences more. Claims like that mustn't go unsourced, stats just don't work that way.
null
0
1318973521
False
0
c2sjlzs
t3_lg6ms
null
t1_c2sjlzs
t1_c2sjbu2
null
1427750040
3
t5_2fwo
null
null
null
True
curien
null
I saw code for a TI DSP where sizeof(int) was 1.
null
0
1318973548
False
0
c2sjm45
t3_lgfp0
null
t1_c2sjm45
t1_c2sjlis
null
1427750042
7
t5_2fwo
null
null
null
True
how_gauche
null
The number one rule of thumb when profiling programs in any language is that most performance pain points are limited to a very small subset of the entire program: i.e., the hotspots. Once someone writes a fast library, like bytestring, vector, unordered-containers, hashtables, etc., you get to make use of it with high...
null
0
1318973587
False
0
c2sjmb1
t3_lfm1k
null
t1_c2sjmb1
t1_c2sf33c
null
1427750043
3
t5_2fwo
null
null
null
True
loswa
null
Exactly. For instance, one of the biggest classes of errors I've always had has been in string representations. Specifically, that a single data type represents so many different things that it is very easy to lose mental track of, for example, exactly what is in a string and how it is formatted (is this filename abs...
null
0
1318973634
False
0
c2sjmjq
t3_lfm1k
null
t1_c2sjmjq
t1_c2seh46
null
1427750045
7
t5_2fwo
null
null
null
True
elperroborrachotoo
null
I'd say if you go language-legal, that wikipedia's "many" is definitely not good enough.
null
0
1318973655
False
0
c2sjmn2
t3_lgfp0
null
t1_c2sjmn2
t1_c2sjfe2
null
1427750046
1
t5_2fwo
null
null
null
True
melkorhatedthesea
null
Hence using int32_t instead of just int. At least the intent is clear.
null
0
1318973666
False
0
c2sjmpj
t3_lgfp0
null
t1_c2sjmpj
t1_c2sjm45
null
1428192065
9
t5_2fwo
null
null
null
True
curien
null
sizeof(char) is always 1 (per the standard). On that architecture, char, short, int, and long were all 32 bit, and CHAR_BIT was 32.
null
0
1318973688
False
0
c2sjmt6
t3_lgfp0
null
t1_c2sjmt6
t1_c2sjlso
null
1427750047
8
t5_2fwo
null
null
null
True
_ch3m
null
I have an exam about design patterns next week and I love you.
null
0
1318973709
False
0
c2sjmx8
t3_lg6ms
null
t1_c2sjmx8
t3_lg6ms
null
1427750049
2
t5_2fwo
null
null
null
True
desrosiers
null
I've got a question. In applied programming (a job, a program for consumer use) how often do you run into things like this? How often is it important to know how to twiddle through these things? And, if possible, examples?
null
0
1318973765
False
0
c2sjn6o
t3_lgfp0
null
t1_c2sjn6o
t3_lgfp0
null
1427750065
2
t5_2fwo
null
null
null
True
MarshallBanana
null
I am not sure what you are arguing now.
null
0
1318973775
False
0
c2sjn8w
t3_lgfp0
null
t1_c2sjn8w
t1_c2sjmn2
null
1427750056
2
t5_2fwo
null
null
null
True
[deleted]
null
[deleted]
null
0
1318973805
False
0
c2sjnf1
t3_lgfp0
null
t1_c2sjnf1
t1_c2sji7a
null
1427750059
16
t5_2fwo
null
null
null
True
AlonzoIsOurChurch
null
Usually #2, sometimes #1, occasionally #3---those are the most painful.
null
0
1318973806
False
0
c2sjnfd
t3_lgoan
null
t1_c2sjnfd
t3_lgoan
null
1427750059
1
t5_2fwo
null
null
null
True
ash_gti
null
While volatile does cause the compiler to generate code that re-accesses the memory location every time its read, it actually has nothing to do with concurrency or threading or making code parallel. It has to do with MMIO (memory mapped IO) and interrupts, hence why micro controllers use volatile all the time. MMIO a...
null
0
1318973844
False
0
c2sjnlz
t3_lgjhl
null
t1_c2sjnlz
t1_c2sj9vh
null
1427750061
17
t5_2fwo
null
null
null
True
MarshallBanana
null
He very specifically said int32_t, which may or may not be int, but is guaranteed to be 32 bits.
null
0
1318973850
False
0
c2sjnnn
t3_lgfp0
null
t1_c2sjnnn
t1_c2sjm45
null
1427750061
-3
t5_2fwo
null
null
null
True
curien
null
No, it's not. If CHAR_BIT is 32, sizeof(int32_t) could be 1. Nothing says char has to be 8 bits. But even if CHAR_BIT is 8, sizeof(int32_t) *still* isn't guaranteed to be 4; it's just guaranteed to be *at least* 4.
null
0
1318973879
False
0
c2sjnsp
t3_lgfp0
null
t1_c2sjnsp
t1_c2sjmpj
null
1427750064
19
t5_2fwo
null
null
null
True
frankster
null
its shit; they fucked up on question 2 by making an assumption that is not supported by any information in the question. thus they are not as good as they think they are. don't work for them - its a trap.
null
0
1318973880
False
0
c2sjnsr
t3_lgfp0
null
t1_c2sjnsr
t3_lgfp0
null
1427750064
-1
t5_2fwo
null
null
null
True
CylonGlitch
null
Which is wrong. Assume XPn are int pointers, and X is X[10]. xp1 = X gives the address of the first element in the array, but xp2 = X+1 gives the first element of the item past the end of the array (&X[10] + sizeof(Int)). Thus the confusion and the quiz that started this whole discussion.
null
0
1318973884
False
0
c2sjnti
t3_lgfp0
null
t1_c2sjnti
t1_c2sjjv8
null
1427750064
3
t5_2fwo
null
null
null
True
elperroborrachotoo
null
If no original author is available, I'd be more eager to press for a refactoring attempt before a rewrite. The reason is simple: people tend to make the same mistakes. This has been shown by studies , and I've had a few cases where someone eager to "throw out that messy crap and write it new, better" introduced the e...
null
0
1318973888
False
0
c2sjnu9
t3_ldgye
null
t1_c2sjnu9
t1_c2sjlwu
null
1427750064
1
t5_2fwo
null
null
null
True
[deleted]
null
[deleted]
null
0
1318973904
False
0
c2sjnwn
t3_lgfp0
null
t1_c2sjnwn
t1_c2sjjdg
null
1427750066
1
t5_2fwo
null
null
null
True
CylonGlitch
null
But that isn't what you wrote, you wrote : > In today's world, there is only one sizeof(int) you will ever encounter, and that is 4. Which is MOSTLY true for standard programming, but NOT true for embedded programming.
null
0
1318973977
False
0
c2sjo9a
t3_lgfp0
null
t1_c2sjo9a
t1_c2sj7oy
null
1427750069
5
t5_2fwo
null
null
null
True
TrolliestTroll
null
That was a fairly dreadful explanation of Fuf; it doesn't really give some of its more powerful features justice. Also you really shouldn't make assumptions about the readers configuration. While , might be the most common leader key it's by no means the only. You might explain why you selected the (arbitrary looking) ...
null
0
1318973979
False
0
c2sjo9h
t3_lghyk
null
t1_c2sjo9h
t3_lghyk
null
1427750069
4
t5_2fwo
null
null
null
True
frankster
null
but the entire point is that if you're being correct and precise about pointers, then you are also being correct and precise about types as well.
null
0
1318973994
False
0
c2sjocm
t3_lgfp0
null
t1_c2sjocm
t1_c2shygc
null
1427750069
0
t5_2fwo
null
null
null
True
wadcann
null
>This is absolutely vital for certain forms of inter-thread communication to work, and also for many embedded platforms, where hardware control is directly bound to the program's address space (ie. something like *(volatile int*)(0x102f0) = 1; might turn on a LED). I'll agree with the memory-mapped I/O. However, I...
null
0
1318974058
True
0
c2sjopk
t3_lgjhl
null
t1_c2sjopk
t1_c2sibxr
null
1427750072
3
t5_2fwo
null
null
null
True
frankster
null
they managed it when they went to 32 architectures, so there's no reason they won't manage it again. plus, at that time there was much worse c standard support for specifying exact sizes in aportable way.
null
0
1318974083
False
0
c2sjoug
t3_lgfp0
null
t1_c2sjoug
t1_c2sj44d
null
1427750074
2
t5_2fwo
null
null
null
True
[deleted]
null
>So let me get this straight: you would like to not have to worry about the representation of your data, and instead choose a data structure that is nearly pessimal in terms of cache-line misses No, I want to not have to worry about the representation of my data, that's all. If the language is such that the most o...
null
0
1318974089
False
0
c2sjovl
t3_lfm1k
null
t1_c2sjovl
t1_c2sj8zn
null
1428192064
-1
t5_2fwo
null
null
null
True
[deleted]
null
I'm sure they'd provide a source if you contacted them. But trusting your own experiences over data is how you lead to believing in ghosts and other complete nonsense. Your senses suck, and so does your memory.
null
0
1318974096
False
0
c2sjowy
t3_lg6ms
null
t1_c2sjowy
t1_c2sjlzs
null
1428192065
-1
t5_2fwo
null
null
null
True
freedoodle
null
Glad you're using the scientific method!
null
0
1318974103
False
0
c2sjoy2
t3_lgecn
null
t1_c2sjoy2
t1_c2sjl3a
null
1427750075
3
t5_2fwo
null
null
null
True
frankster
null
thus illustrating exactly why questions 2 and 4 are badly defined.
null
0
1318974140
False
0
c2sjp4y
t3_lgfp0
null
t1_c2sjp4y
t1_c2sj8h7
null
1427750076
1
t5_2fwo
null
null
null
True
curien
null
So what? If CHAR_BIT is 32, sizeof(int32_t) could be 1.
null
0
1318974153
False
0
c2sjp7q
t3_lgfp0
null
t1_c2sjp7q
t1_c2sjnnn
null
1427750077
6
t5_2fwo
null
null
null
True
EmptyComplete
null
I really like [oodesign](http://www.oodesign.com/). It has great explanations, code examples, and it also points out things to note and look out for.
null
0
1318974252
False
0
c2sjpp6
t3_lg6ms
null
t1_c2sjpp6
t3_lg6ms
null
1428192063
1
t5_2fwo
null
null
null
True
m1ss1ontomars2k4
null
Well, also when you try to do array_name++...
null
0
1318974267
False
0
c2sjprr
t3_lgfp0
null
t1_c2sjprr
t1_c2sjbpt
null
1427750089
6
t5_2fwo
null
null
null
True
frankster
null
exactly; its a shit quiz written by smug programmers who got egg on their face.
null
0
1318974286
False
0
c2sjpv4
t3_lgfp0
null
t1_c2sjpv4
t1_c2shf09
null
1427750097
-5
t5_2fwo
null
null
null
True
curien
null
Apparently you didn't pass the quiz. X+N and &X[N] are equivalent by definition.
null
0
1318974333
False
0
c2sjq38
t3_lgfp0
null
t1_c2sjq38
t1_c2sjnti
null
1427750100
3
t5_2fwo
null
null
null
True
frutiger
null
That's certainly correct, but you don't yet know the size of a byte (equivalently a char).
null
0
1318974354
False
0
c2sjq7m
t3_lgfp0
null
t1_c2sjq7m
t1_c2sjnnn
null
1427750097
2
t5_2fwo
null
null
null
True
frankster
null
No. The whole point is that it is implementation defined. And any non-shit c programmer should be aware of this.
null
0
1318974361
False
0
c2sjq8r
t3_lgfp0
null
t1_c2sjq8r
t1_c2sj8kh
null
1427750097
6
t5_2fwo
null
null
null
True
pjakubo86
null
I won! (Except I thought sizeof(int) was 8 on 64 bit systems. Doh!)
null
0
1318974361
False
0
c2sjq8y
t3_lgfp0
null
t1_c2sjq8y
t3_lgfp0
null
1427750097
0
t5_2fwo
null
null
null
True
m1ss1ontomars2k4
null
It's valid in Octave though.
null
0
1318974459
False
0
c2sjqnw
t3_lg5ri
null
t1_c2sjqnw
t1_c2sfbbm
null
1427750103
3
t5_2fwo
null
null
null
True
melkorhatedthesea
null
Oy, one more thing to worry about when selecting new hw platforms. Don't change my CHAR_BIT! TIL, though so thanks.
null
0
1318974596
False
0
c2sjri0
t3_lgfp0
null
t1_c2sjri0
t1_c2sjnsp
null
1427750118
1
t5_2fwo
null
null
null
True
[deleted]
null
[deleted]
null
0
1318974672
False
0
c2sjrwo
t3_lff3n
null
t1_c2sjrwo
t1_c2safl8
null
1427750116
1
t5_2fwo
null
null
null
True
FeepingCreature
null
Okay, show me _any_ system in actual use where char is not 8 bits. If anybody ever makes an int32_t that is not 32 bit, I will come to their house and slap them in the face (if I'm ever in the neighbourhood). For fuck's sake, the entire _point_ of calling it int**32**_t is that it's 32 bits!
null
0
1318974707
False
0
c2sjs2x
t3_lgfp0
null
t1_c2sjs2x
t1_c2sjnsp
null
1427750118
1
t5_2fwo
null
null
null
True
CylonGlitch
null
Sorry, right, I misread what you wrote, I thought you wrote &X + N. Duh. Yeah, X + n does work but is not as necessarly clear to someone reading it later on. &X[n] says the address of the n'th element of array X; where as X + n could be the X (a value) plus n or pointer X plus an offset of 1 (same as &X[...
null
0
1318974731
False
0
c2sjs7r
t3_lgfp0
null
t1_c2sjs7r
t1_c2sjq38
null
1427750120
3
t5_2fwo
null
null
null
True
pjakubo86
null
OK. We could probably assume that the problem is referencing a C99-compliant C implementation. From the C99 spec: "The typedef name intN_t designates a signed integer type with width N, no padding bits, and a two’s complement representation. Thus, int8_t denotes a signed integer type with a width of exactly 8 bits."
null
0
1318974856
False
0
c2sjsv3
t3_lgfp0
null
t1_c2sjsv3
t1_c2sjnsp
null
1427750124
10
t5_2fwo
null
null
null
True
FeepingCreature
null
Fucking wackos.
null
0
1318974883
False
0
c2sjszz
t3_lgfp0
null
t1_c2sjszz
t1_c2sjmt6
null
1427750125
6
t5_2fwo
null
null
null