Live data from Hacker News

Poll: Do you know C?

news.ycombinator.com

31–40 of 208 posts

Re: Poll: Do you know C?

#33
post #5

I used to know it very well. Now, not as much. Even when I wrote C++, I basically wrote "C, with classes."

Why write C-with-classes if you can just write C-with-structures-and-function-pointers instead?

C-with-structures-and-function-pointers doesn't give you easy inheritance, polymorphism, etc. Now anthropomorphism ... that would be fun.

Re: Poll: Do you know C?

#34
I've learned some C, but I wouldn't be able to write a program in it without a lot of documentation. I can read it, but I don't use it or use it once or twice a year.

but i know objective-c pretty well.

Re: Poll: Do you know C?

#37
post #5

I used to know it very well. Now, not as much. Even when I wrote C++, I basically wrote "C, with classes."

Why write C-with-classes if you can just write C-with-structures-and-function-pointers instead?

If you're a C purist (or just a purist in general) then of course you're right, but I personally think that C-with-classes is clearer, easier for a layman to understand (many people who call themselves C programmers still get nervous when function pointers come out to play), and is usually worth the trade-offs. You can write a lot of very decent code this way and have a little bit of "the best of both worlds", and avoid getting into a lot of the admittedly very dark corners and nasty surprises that C++ has to offer...

Re: Poll: Do you know C?

#39
post #35

Earlier quoted context omitted.

Why write C-with-classes if you can just write C-with-structures-and-function-pointers instead?

What would be the advantage of doing that?

No exceptions to deal with: http://ptgmedia.pearsoncmg.com/images/020163371x/supplements...

That's probably a really big one in terms of reliability.

Also, the weird C++ behavior of calling copy constructors in the most unexpected places can have a very detrimental effect on performance.

Personally, I think the nature of C++ class definition leads people down the primrose path of trying to provide all potentially useful methods, of which only a tiny fraction get used. Tons of dead code appears in most C++ projects.

Re: Poll: Do you know C?

#40
C is the only language that I use at work (along some basic scripting). Due to work that is mainly firmware, device drivers etc. Honestly at times, I do feel that embedded engineers are odd persons out here at HN.
Post reply on HN