Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > Re: type-punnin...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 14 of 16 Topic 26091 of 26972
Post > Topic >>

Re: type-punning?

by Harald van =?UTF-8?b?RMSzaw==?= <truedfx@[EMAIL PROTECTED] > May 6, 2008 at 11:11 PM

On Tue, 06 May 2008 16:26:19 -0400, Kenneth Brody wrote:
> Note, too, that Mr. van D?k (sorry about the mangling of the name, but
> my newsreader is obviously not UTF-8 compliant)

<OT> It could be that your system font simply doesn't contain the 
character, but the newsreader still is UTF-8 compliant. :) </OT>

> says that the standard
> does say that "void *" and "char *" are special cases which must be
> represented the same way.  If that is true,

6.2.5p27:
"A pointer to void shall have the same representation and alignment 
requirements as a pointer to a character type."

> then your original example
> will "work" as-is, but only because you are converting "char **" to
> "void **".

No, and I had tried to make that explicit. I wrote "you still aren't 
allowed to access one as the other anyway (except in special 
cir***stances)". Those special cir***stances would be using memcpy or an 
union to copy between distinct pointer types. Using *(char **) &p when p 
is defined as void *p, or vice versa, is not one of those special 
cir***stances, and when you do that, the behaviour is still undefined, 
just like the behaviour is undefined if you use *(int **) &p on systems 
where int * has the same representation and alignment requirements as
void *.
 




 16 Posts in Topic:
type-punning?
j.j.fishbat@[EMAIL PROTEC  2008-05-06 08:46:00 
Re: type-punning?
vippstar@[EMAIL PROTECTED  2008-05-06 09:43:53 
Re: type-punning?
Harald van =?UTF-8?b?RMSz  2008-05-06 19:35:00 
Re: type-punning?
Andrey Tarasevich <and  2008-05-06 11:05:25 
Re: type-punning?
lawrence.jones@[EMAIL PRO  2008-05-06 14:39:47 
Re: type-punning?
j.j.fishbat@[EMAIL PROTEC  2008-05-06 11:17:38 
Re: type-punning?
Andrey Tarasevich <and  2008-05-06 11:24:55 
Re: type-punning?
Harald van =?UTF-8?b?RMSz  2008-05-06 20:32:01 
Re: type-punning?
Kenneth Brody <kenbrod  2008-05-06 14:34:57 
Re: type-punning?
Harald van =?UTF-8?b?RMSz  2008-05-06 20:50:08 
Re: type-punning?
j.j.fishbat@[EMAIL PROTEC  2008-05-06 11:56:36 
Re: type-punning?
Kenneth Brody <kenbrod  2008-05-06 16:26:19 
Re: type-punning?
Kaz Kylheku <kkylheku@  2008-05-06 14:02:24 
Re: type-punning?
Harald van =?UTF-8?b?RMSz  2008-05-06 23:11:51 
Re: type-punning?
"Default User"   2008-05-06 22:49:07 
Re: type-punning?
Ben Bacarisse <ben.use  2008-05-06 22:17:42 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 21:30:13 CDT 2008.