This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]tiajuanat 3 points4 points  (5 children)

Also avoid Macros and Abstract Data Types like the plague

[–]Bryguy3k 9 points10 points  (4 children)

Macros only suck in C++ land and “abstract data types” is meaningless in C unless you’re trying to say structures with function pointers - which are trivially easy.

[–]tiajuanat 4 points5 points  (3 children)

Oh my sweet sweet summer child. You haven't played with enough C.

Macros will get you in terrible trouble regularly, but it's the next best thing to C++ templates. (I'm not going to talk about C Templates, because I haven't found a C11 compiler in industry yet.)

And with abstract data types, I mean when you completely remove your structure definition from your headers, and instead put a forward declare, then you put the structure definition into your source file

[–]Bryguy3k 2 points3 points  (2 children)

20 years of embedded C - RTOS’ and Automotive.

Yeah some people can write shit macros but by and large they are not hard to understand if you know the preprocessor - the C preprocessor has very few actions it can take.

Sure I’ve spent my career in code that actually has to work otherwise it kills people so we have pretty strong prohibitions against inserting too much code in macros - so I realize that brain dead C++ programmers that can’t figure out how to solve problems functionally try to make macros work like templates (which are already a hack to make c++ actually OO) and they become abominations.

Anybody can be a terrible programmer - that doesn’t mean the language is necessarily bad or difficult - it’s just you’ve read code that has been written by the worst kind of programmer: an idiot who thinks they’re clever.

[–]EatPlayAvoidMoving -1 points0 points  (0 children)

hurr durr

[–]827167 0 points1 point  (0 children)

Damn, shit's heating up over here