Re: pointer q
- From: "Joe Smith" <grumpy196884@xxxxxxxxxxx>
- Date: Tue, 16 May 2006 15:51:02 -0400
"Flash Gordon" <spam@xxxxxxxxxxxxxxxxxx>
Joe Smith wrote:[ill-advised and illegal stuff]
"Flash Gordon" <spam@xxxxxxxxxxxxxxxxxx>
Is it the miscast here that creates the unitialized pointer?short *sp;
*sp = (short)*lp; /* ill-advised, but Let's Pretend */
Writes through an uninitialised pointer which is undefined behaviour.
It seems to me that indeed this would be a way to discern endianness.I think if a fellow were serious, ie, trying not to do illegal or
ill-advised things, and he wanted to "pick apart" something that the
compiler has stored as a long at an address accessible to the source, he
would go after it with the last of those options, unsigned chars, and
make the necessary conversions to make zeroes and ones.
Yes, using unsigned char would be the correct way to pick it apart, and
indeed there are sometimes good reasons for doing this.. You still have to
watch out for endianness and be aware that different implementations have
different length longs.
Crap, I was really proud of that, using only the space bars for spaces andThere's something driving me bats right now. How does one complete this
table:
long * | short | long ***
-------------------------------------------------
type is | | |
----------------------------------
type-specifier is | | |
You should really use a fixed width font when doing things like tables. It
may have looked formatted on your machine, but here it looks a right mess,
and I'm not going to try all my fonts on the off chance one uses the same
spacings as whatever font you used.
The type specifiers in the above are short and long. The types are long*,
short and long***.
explicit carriage return. Alles klar on the answer. joe
.
- Follow-Ups:
- Re: pointer q
- From: Flash Gordon
- Re: pointer q
- References:
- pointer q
- From: Joe Smith
- Re: pointer q
- From: Keith Thompson
- Re: pointer q
- From: Joe Smith
- Re: pointer q
- From: Eric Sosman
- Re: pointer q
- From: RSoIsCaIrLiIoA
- Re: pointer q
- From: Joe Smith
- Re: pointer q
- From: Flash Gordon
- Re: pointer q
- From: Joe Smith
- Re: pointer q
- From: Flash Gordon
- Re: pointer q
- From: Joe Smith
- Re: pointer q
- From: Flash Gordon
- pointer q
- Prev by Date: Re: Converting Float to unsigned short and Back
- Next by Date: Re: overloading, template, exception handling and c
- Previous by thread: Re: pointer q
- Next by thread: Re: pointer q
- Index(es):