Arrrrg. I need to vent off.
-
I know this is not for programming, but imagine my frustration when I discovered a bug that was not reported by my compiler: const uint8 kEdlReplyTimeout = 500; Of course, it does not fit in 8 bit (typedefed uint8) and stupid MetroWerks accepts this silently, until I realize it on my own. Sometimes, I just hate my good old msvc 6.0 compiler, but I got to admit, it doesn't let me down on simple things like that one.
-
I know this is not for programming, but imagine my frustration when I discovered a bug that was not reported by my compiler: const uint8 kEdlReplyTimeout = 500; Of course, it does not fit in 8 bit (typedefed uint8) and stupid MetroWerks accepts this silently, until I realize it on my own. Sometimes, I just hate my good old msvc 6.0 compiler, but I got to admit, it doesn't let me down on simple things like that one.
Yowzers. That's pretty criminal of a compiler not to complain. One thing though, not that the compiler would know the difference if it's properly def'd, but really: uint8 hmmm. unsigned int, erm, 8 bits. Well, int's arent unsigned usually, and their usually not 8 bits. So as the type definition label, I would get confused too. Maybe "u8" or "byte" would be better. Just my 2c. Marc Microsoft MVP, Visual C# MyXaml MyXaml Blog Hunt The Wumpus RealDevs.Net
-
Yowzers. That's pretty criminal of a compiler not to complain. One thing though, not that the compiler would know the difference if it's properly def'd, but really: uint8 hmmm. unsigned int, erm, 8 bits. Well, int's arent unsigned usually, and their usually not 8 bits. So as the type definition label, I would get confused too. Maybe "u8" or "byte" would be better. Just my 2c. Marc Microsoft MVP, Visual C# MyXaml MyXaml Blog Hunt The Wumpus RealDevs.Net
I work with micro controllers, and I tought that cross platform communication is fun with this set of types: int8, int16, int32, int64 uint8, uint16, uint32, uint64. When one reads a class definition, one knows the number of bytes that one is talking about. My own 2c. :)
-
I work with micro controllers, and I tought that cross platform communication is fun with this set of types: int8, int16, int32, int64 uint8, uint16, uint32, uint64. When one reads a class definition, one knows the number of bytes that one is talking about. My own 2c. :)
> number of bytes that one is talking about. Bits, surely? :suss: Jon
-
> number of bytes that one is talking about. Bits, surely? :suss: Jon
If you know how many bytes, you implicitly know how many bits. The reverse holds as well, as bits are grouped in bytes (on most MODERN systems - don't even think about shooting me down for this you old VAX hacker or whoever you are reading this. Are you a bearded guy in your 60's Jon? ;)) -- Denn du bist, was du isst! Und ihr wisst, was es ist! Es ist mein Teil...?
-
Yowzers. That's pretty criminal of a compiler not to complain. One thing though, not that the compiler would know the difference if it's properly def'd, but really: uint8 hmmm. unsigned int, erm, 8 bits. Well, int's arent unsigned usually, and their usually not 8 bits. So as the type definition label, I would get confused too. Maybe "u8" or "byte" would be better. Just my 2c. Marc Microsoft MVP, Visual C# MyXaml MyXaml Blog Hunt The Wumpus RealDevs.Net
You might expect a warning from a modern compiler maybe, but clearly it is not the compiler, but the ANSI-C specification that needs to face the criminal charges here. The assignment is as legal as assigning +128 to a signed (8 bit) integer, and many other cases. As long as implicit conversion rules allow for the conversion, it's fine as far as the language standard is concerned. Use PC-Lint to find these, and many other, issues!
-
You might expect a warning from a modern compiler maybe, but clearly it is not the compiler, but the ANSI-C specification that needs to face the criminal charges here. The assignment is as legal as assigning +128 to a signed (8 bit) integer, and many other cases. As long as implicit conversion rules allow for the conversion, it's fine as far as the language standard is concerned. Use PC-Lint to find these, and many other, issues!
berndg wrote: The assignment is as legal Are you sure? 500 doesn't exactly fit into an 8 bit quantity. Marc Microsoft MVP, Visual C# MyXaml MyXaml Blog Hunt The Wumpus RealDevs.Net
-
berndg wrote: The assignment is as legal Are you sure? 500 doesn't exactly fit into an 8 bit quantity. Marc Microsoft MVP, Visual C# MyXaml MyXaml Blog Hunt The Wumpus RealDevs.Net
-
I don't have the time to dig through the ANSI-C papers, but I am pretty sure this is a valid (though unhelpful) C assignment, just like all these: unsigned int a = -2; signed char b = 128; unsigned char c = 500; unsigned short s = -1L;