Live data from Hacker News

Deep C and C++ (2011)

slideshare.net

61–70 of 243 posts

Re: Deep C and C++ (2011)

#63
post #49

Earlier quoted context omitted.

"In embedded software, life would be a lot easier if I could hit every engineer who wants to type-pun without a union in the head with the ISO standard." Is that the same standard that says it is illegal to write to one entry and read from another in a union* ? * Note : special situation of identical fields in a structure

The C99 standard explicitly says type punning through a union is allowed. This is clarified in TC3 (2007) by the addition of this note in section 6.5.2.3: If the member used to access the contents of a union object is not the same as the member last used to store a value in the object, the appropriate part of the object representation of the value is reinterpreted as an object representation in the new type as descri…

Thanks, I was not aware that this was corrected in a later edition.

Re: Deep C and C++ (2011)

#64
post #58

A fun fact about sequence points. C++ has switched from "sequence points" to "sequenced before/sequenced after" relation. And it is not really "all" previous side-effects that are guaranteed to be visible after the sequence point but only those associated with the sequence point. In 'foo(b++, a++ && (a+b));' the sequence point introduced by the '&&' only makes the 'a' see the effect 'a++' but the 'b' might not see th…

Right! In fact I believe the above code invokes undefined behavior, because b may be accessed for a reason other than to determine its new value, without an intervening sequence point.

Put another way, the compiler can arbitrarily interleave the subexpressions within separate arguments:

    foo( a() && b(), c() && d() );
The compiler is free to invoke these functions in the order a(), c(), d(), b() if it pleases.

Re: Deep C and C++ (2011)

#66
post #65
post #62

[deleted]

[deleted]

Ooh. I remember "Dynamic-C" and its built-in support for coroutines. TI and Microchip had their own quasi-proprietary extensions to C, but I don't think I ever saw anyone go as far as Rabbit did.

Re: Deep C and C++ (2011)

#67

A college student in CS here. I'm always impressed by people with deep understanding of programming language internals and try to pick up as much about programming language internal workings and compilers as I can. How does one get really good at this? Is it by spending a lot of time programming and building stuff? Is it by reading books/blogs/articles about programming languages? Any recommendations for such resourc…

Get hold of an embedded microprocessor and write some silly app for it. E.g. ZigBee or Digi's rabbit microprocessors.

I learned all my "deep C" on the rabbit. The architecture is based on Z80 and the compiler is a really shitty non-standard C compiler with some custom syntax.

You will very quickly learn to throw away many assumptions you might have about how things work. Learn how to write mutithreaded code without an operating system or a thread library (hint: co-routines). Learn how memory layout, very quickly get a feel for the time/space tradeoffs of different algorithms, etc.

Re: Deep C and C++ (2011)

#68

This was good, but… Hermione (I'm sure that's her) rates her C++ knowledge at 4-5, and Stroustrup himself at 7!? Bullshit. Either they are poorly calibrated, or they are displaying false modesty. Sure, they probably still have plenty to learn about C++, but come on, Hermione is already at the top 97% in terms of language lawyering. Wanting to be stronger is good. Not realizing you're already quite strong is not so go…

I think the author is just taking into account the Dunning–Kruger effect.

Re: Deep C and C++ (2011)

#69

This was good, but… Hermione (I'm sure that's her) rates her C++ knowledge at 4-5, and Stroustrup himself at 7!? Bullshit. Either they are poorly calibrated, or they are displaying false modesty. Sure, they probably still have plenty to learn about C++, but come on, Hermione is already at the top 97% in terms of language lawyering. Wanting to be stronger is good. Not realizing you're already quite strong is not so go…

It's all relative. I would consider a 10 somebody who could write the C++ compiler without guidance for example. And probably give myself a 4 as a result.

Would you only consider someone's knowledge of Python a 10 if they could write a Python interpreter without guidance?

Re: Deep C and C++ (2011)

#70
post #27

Earlier quoted context omitted.

Yes, this worries me. Especially today some people think "great programmers" are the ones who knows all the "fashionable" tools and frameworks, wants to abstract everything (god help him if he install vim in his test environment without a fab file that configures chef) and maybe worships Uncle Bob Knowing how to use Redis is cool, do you know what's even cooler? Being able to write it (or at least knowing how it work…

I'll rather pay an artist to paint me a nice piece using store bought paint than making his/her own paint. Each programmer is great in their own right.

Each programmer is great in their own right.

Some of them, however, are terrible at programming.

Post reply on HN