Live data from Hacker News

C for high level programmers (slides)

charliethe.ninja

11–20 of 129 posts

Re: C for high level programmers (slides)

#14

No mention of undefined behavior? That's the first thing I tell people about C, considering how easy it is to trigger.

The issue with undefined behavior is it's kind of hard to... well... define. It's an odd combination of unsafe memory, float/integer rollover, and rules with memory allocation. I wasn't quite sure how to clearly state it.

Re: C for high level programmers (slides)

#17
teaching C and not checking malloc, bad idea. using realloc in the way its used in this "tutorial" can cause memory leaks. realloc should be checked before reassigned because it can return NULL and that will overwrite the previous valid memory address.

Re: C for high level programmers (slides)

#18

No mention of undefined behavior? That's the first thing I tell people about C, considering how easy it is to trigger.

The issue with undefined behavior is it's kind of hard to... well... define. It's an odd combination of unsafe memory, float/integer rollover, and rules with memory allocation. I wasn't quite sure how to clearly state it.

Yeah I tend not to get hung up on the different ways it can trigger. It's more like, if you trigger it your program might run fine for now and then suddenly act up one day. It might die before the undefined behavior. It might launch nukes. Still sure you want to get into this? No? Want to go back to Ruby? Well, Ruby is built atop C. That's the five states of grief I try to get them through.

Re: C for high level programmers (slides)

#19

  C is quirky, flawed, and an enormous success. While accidents of history surely
  helped, it evidently satisfied a need for a system implementation language
  efficient enough to displace assembly language, yet sufficiently abstract and
  fluent to describe algorithms and interactions in a wide variety of environments.

  -- Dennis M. Ritchie (in "The Development of the C Language" [1])
[1] http://heim.ifi.uio.no/inf2270/programmer/historien-om-C.pdf
Post reply on HN