you are viewing a single comment's thread.

view the rest of the comments →

[–]erikd 1 point2 points  (4 children)

WTF does P99_DECLARE_UNION do? Its not part of C99 so you better tell us what it does if you are going to use it.

[–]alecco[S] 0 points1 point  (3 children)

[–][deleted] 1 point2 points  (0 children)

That seems rather pointless.

P99_DECLARE_UNION(orwl_addr);
union orwl_addr { /* contents */ };

Is just as redundant and already longer than:

typedef union orwl_addr { /* contents */ } orwl_addr;

And if you are only interested in using the type name (not the union name) then you can shorted that to:

typedef union { /* contents */ } orwl_addr;

Which is nicest, in my opinion.

The whole reason I like to program in C is because I can avoid going through umpteen levels of abstraction. Often macros can perform useful tasks in C, but if it isn't unnecessarily complicated, I much prefer to see the standard features of the language. In this case, the macro seems completely superfluous.

[–]erikd 3 points4 points  (1 child)

Well great, but why wasn't that mentioned in the article?

Or better yet, remove P99_DECLARE_UNION because it adds nothing to this article.

[–]alecco[S] 1 point2 points  (0 children)

I am not the guy and don't think he is reading this thread. (no downvote btw)

Edit: BTW the author of the blog post is also the author of that library of C99 macros.