??? 08/26/08 23:40 Read: times |
#157781 - union misuse Responding to: ???'s previous message |
Per Westermark said:
Using an union doesn't buy you any extra security when converting from four raw bytes to a float. I won't comment on the casted pointer dereference method because I don't remember reading the language explicitly addressing the issue. However, using a union in the manner of the other post is a quite common misuse of the language, the standard for which states: The value of at most one of the members can be stored in a union object at any time. So, the union method does have the disadvantage of the language standard disallowing it (although many of us use it). |
Topic | Author | Date |
silly C question | 01/01/70 00:00 | |
*(float*)&time | 01/01/70 00:00 | |
Thanks!!! | 01/01/70 00:00 | |
Here's one without wild casting: | 01/01/70 00:00 | |
Nothing wild | 01/01/70 00:00 | |
union misuse | 01/01/70 00:00 | |
Not hiding cast | 01/01/70 00:00 | |
Programmer knowledge required. | 01/01/70 00:00 | |
Hiding of portability issue | 01/01/70 00:00 | |
Portability C | 01/01/70 00:00 |