News for hackers. Stuff that matters.
Re:My personal C coding style as of late 2023 by oaiey on Monday October 09, 2023 @08:36AM (#37819787)
No. It would be better if the standardization groups would have done that, but not when every developer has a different scheme
Re:My personal C coding style as of late 2023 by circuit10 on Monday October 09, 2023 @09:17AM (#37820173)
It’s not great but they’re just aliases so they’re interchangeable, which means you can keep everything consistent within a project and it won’t cause any problems when interacting with outside code
Re:My personal C coding style as of late 2023 by lelanthran on Monday October 09, 2023 @01:16PM (#37822715)
Until you include a header written by someone with the same opinion, and now you get compile errors because they both defined 'u8'.

I gotta be honest, all of those style suggestions look good until you try them in a non-solo and non-isolated project, and then you see what a mess you created.

We've all been there, as C programmers, and we've all done that in the past, which is why we don't do it anymore

Re:My personal C coding style as of late 2023 by circuit10 on Monday October 09, 2023 @05:15PM (#37825588)
Unless they were defined to completely different types, that shouldn’t be an error
Re:My personal C coding style as of late 2023 by lelanthran on Tuesday October 10, 2023 @01:36AM (#37828853)
> Unless they were defined to completely different types, that shouldn’t be an error

In this case it almost certainly will be - after all, the blog posts `byte` is defined as char, which could be signed or unsigned. A correct typedef for `byte` is `uint8_t`, so it's almost guaranteed that this will conflict.

Which is why I said it's best not to redefine the primitive types - you're almost certain to conflict with someone else who defined it differently.