Article View: fr.comp.lang.c
Article #15620Re: alignements struct/tableaux
From: Pierre Habouzit
Date: Sat, 17 Sep 2005 19:04
Date: Sat, 17 Sep 2005 19:04
33 lines
2169 bytes
2169 bytes
>> &bar->array[0] == &bar->first
>
> Oui, mais par contre
>
>> &bar->array[1] == &bar->second
>
> ceci n'est pas garanti par la norme.
>
> D'une fa�on g�n�rale, ce n'est pas une bonne id�e d'�crire dans un
> membre d'une union est de lire dans un autre. Une union, c'est pas fait
> pour �a.
hmmm, c'est bien dommage.
J'ai des structures dont un des membres est l'indice dans le tableau de mon
union, du pointeur auquel il font r�f�rence. ca m'aurait permis de faire
des trucs du genre :
bar->array[baz->some_index]
Mais lorsque j'y acc�de textuellement je voulais �viter des
bar->array[MY_UNION_FIRST] ... et donc pouvoir acc�der aux pointeurs du
tableau par leur "nom".
le fait de ne pas pouvoir assurer une telle propri�t� est tout de m�me bien
dommage. enfin, tant pis, en virant l'union j'aurai le m�me comportement de
toute facon ... au cout de 16 octets de perdus ;p
--
�O� Pierre Habouzit
��O madcoder@debian.org
OOO http://www.madism.org
Technical Details
Message-ID:
<432c688a$0$14382$626a14ce@news.free.fr>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!infeed-4.proxad.net!news18-e.free.fr!not-for-mailReferences:
<432c52d5$0$9425$626a14ce@news.free.fr> <mn.8cb87d59c7031bee.15512@YOURBRAnoos.fr>Show Full Headers
Complete Article Headers
X-Google-Thread: f9822,2ab126dba8e5e645
X-Google-Attributes: gidf9822,public
X-Google-Language: FRENCH,ASCII
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!infeed-4.proxad.net!news18-e.free.fr!not-for-mail
Message-ID: <432c688a$0$14382$626a14ce@news.free.fr>
From: Pierre Habouzit <madcoder@debian.org>
Subject: Re: alignements struct/tableaux
Newsgroups: fr.comp.lang.c
Date: Sat, 17 Sep 2005 21:04:24 +0200
References: <432c52d5$0$9425$626a14ce@news.free.fr> <mn.8cb87d59c7031bee.15512@YOURBRAnoos.fr>
User-Agent: KNode/0.9.2
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-15
Content-Transfer-Encoding: 8Bit
X-Face: $(^e[V4D-[`f2EmMGz@fgWK!e.B~2g.{08lKPU(nc1J~z\4B>*JEVq:E]7G-\6$Ycr4<;Z!|VY6Grt]+RsS$IMV)f>2)M="tY:ZPcU;&%it2D81X^kNya0=L]"vZmLP+UmKhgq+u*\.dJ8G!N&=EvlD
Lines: 33
Organization: Guest of ProXad - France
NNTP-Posting-Date: 17 Sep 2005 21:03:38 MEST
NNTP-Posting-Host: 82.225.205.10
X-Trace: 1126983818 news18-e.free.fr 14382 82.225.205.10:41395
X-Complaints-To: abuse@proxad.net