4 ms·
I think this slideshow would be better titled 'Standards Compliant C'. At least for the first printf example, I would employ the boy rather than the girl. The
by macavity23 15y ago
I think this slideshow would be better titled 'Standards Compliant C'.
At least for the first printf example, I would employ the boy rather than the girl. The boy gave a correct answer - what was missing, what would happen. The girl spouted a bunch of standards that added no value (with the exception of the 'return 3' which does indeed demonstrate deep knowledge).
In particular, the 'you should add a blank line at the end of your code' comment would immediately make me suspect her to be a finicky letter-of-the-law PITA who would be a nightmare to work with.
Standards are all well and good, but if your code compiles with no warnings and runs without errors according to the spec you were given, nobody of any consequence is going to give a damn.
- danieldk 15y agoI think this slideshow would be better titled 'Standards Compliant C'. Not all of it. People who do not understand the rule of three or when to declare methods or deconstructors virtual can surely cause headaches.
- justinhj 15y agowe actually got bit in game development by the "last line must be blank" standard. along game a compiler that actually complained and we had to write a script to fix up the code.
- bcl 15y ago"Standards are all well and good, but if your code compiles with no warnings and runs without errors according to the spec you were given, nobody of any consequence is going to give a damn." Wait, what?! The whole point of this slideshow is that without a deeper understanding of your language you can end up with errors that you don't anticipate or understand. Your code compiles and runs today. But then you rebuild on a different machine, or with different compiler optimization level, add a seemingly innocuous piece of code here or there and then it starts acting differently. Or you deploy it to your customer and they start seeing intermittent problems with it because you failed to understand when to initialize auto variables. You can never have too much knowledge about the language (and tools) that you are using to build your code. I would even go further and say the same thing about the hardware you or your users are running your code on.
- kenjackson 15y agoWhile I do agree that you can never have too much knowledge, there is a huge dropoff in value. Your code compiles and runs today. But then you rebuild on a different machine, or with different compiler optimization level, add a seemingly innocuous piece of code here or there and then it starts acting differently. IMO this is the problem with the deck. The "problematic" code is code that ppl who don't know the corners of C/C++ aren't likely to write. If you're tempting sequence points in your code, you're asking for trouble, even if you know the standard well because now you're tempting fate you don't make a mistake and you're assuming every compiler implements the standard perfectly (and we all know this isn't the case). And the smart girl makes at least one potential error. She says that, "You said that your runtime is 64bit so that means your pointers are probably 8 bytes". First he never says the runtime is 64bit. He says its a 64bit system running in 32bit compatibility mode. What does 32bit compatibility mode mean? Potentially a lot of things. For example, on Windows it means you have 4 byte pointers. Rather than conjecturing -- this is something she could have just said, "How long are your pointers?" But her character was one that had to have an answer -- even if it meant making a potentially wrong assumption.