Originally posted by brrrrttttt
View Post
Announcement
Collapse
No announcement yet.
GCC Unlikely To Adopt A "-Weverything" For Exposing All Possible Code Warnings
Collapse
X
-
Originally posted by xorbe View PostIn large projects, it's basically impossible to globally throw -Wall -Wextra without a bunch of -Wno-* waivers. Because of external code that can't be changed.
- Likes 2
Comment
-
Sorry for a late reply, just logged in again, and saw this.
Originally posted by mlau View PostCan you give examples? I've written countless drivers and other stuff for hardware that doesn't support unaligned accesses, but never once have I felt the need for a packed struct.
Originally posted by F.Ultra View Post
What is the problem that you have with packed structs? I use packed structs extensively for on the wire protocols with thousands of external sources and have never once encountered a problem with packed structs in GCC and that is going back to 2.x when I begun to use GCC.
Code:struct OrderbookDirectory { char MessageType; uint32_t Nanoseconds; uint32_t OrderbookID; char Symbol[32]; char Name[32]; char ISIN[12]; uint8_t FinancialProduct; char TradingCurrency[3]; uint16_t NumberOfDecimalsInPrice; uint16_t NumberOfDecimalsInNominalValue; uint32_t OddLotSize; uint32_t RoundLotSize; uint32_t BlockLotSize; uint64_t NominalValue; } [B]__attribute__ ((packed))[/B] __attribute__((__may_alias__));
Comment
-
Originally posted by AHSauge View PostThe main problem with packed structs, aside from the performance hit, is some HW don't even support it. This means that the compiler have to deal with it in software, which gives you even more performance hit. So far it's okay. However, what happens if you give someone a pointer to a member of your struct? Well, depending on your hardware you either get a performance hit, incorrect result or a crash. My daily work involves legacy code on HW where I can either choose between incorrect result or a crash. Naturally I go for the crash, and it's biting time and time again. It should be rewritten to avoid packed structures, but no time allowed for it
Comment
-
Originally posted by Weasel View PostThis is why such HW is trash and people should stick to x86.
- Likes 1
Comment
-
Originally posted by wizard69 View PostWhat a bunch of idiots! There is good reason to want to throw all warnings. Beyond that who cares what some developers need, like most compiler switches they get turned on or off based on project needs.
Setiously it is no wonder CLang continues to see new adoption.
Comment
Comment