Re: A: a new bug to old plain C
Henrik Holst via Gcc-help <[email protected]> Mon, 8 Dec 2025 03:08:56 +0100
| Newsgroups | gmane.comp.gcc.help |
|---|---|
| Message-ID | <CAGwK9dy4BVOZCAvp-BN0WY0qUxCrxzJeT9ba58JBxAegOUDdKA@mail.gmail.com> |
Den mån 8 dec. 2025 kl 02:35 skrev Segher Boessenkool < [email protected]>: > On Mon, Dec 08, 2025 at 12:11:14AM +0100, Henrik Holst wrote: > > Den sön 7 dec. 2025 kl 23:46 skrev Segher Boessenkool <[1] > > [email protected]>: > > And no, you never have to go via pointer stuff either. Just assign > to > > something that actually holds the type you are trying to convert to. > > Don't hide aything! It won't help you! > > Yes, exactly like I said. You posting incomplete code (that cannot be > compiled no matter what) does not help your case. > sure about that? struct a a; struct b b = *((struct b *)&a); And before you complain that this is more than adding a cast, consider that this is also an error of the exact same type: struct a a; struct b b = *(&a); Further I also assume that you don't see compiler warnings as disagreeing with you? like in char *a; int b = a; # warning: initialization of ‘int’ from ‘char *’ makes integer from pointer without a cast [-Wint-conversion] /HH > > > Segher >