On Thu, 27 Mar 2003, Philipp Thomas wrote:
> * Anton Altaparmakov (ai...@ca...) [20030327 16:50]:
>
> > > OK. As I'll be sending a patch to remove the use of unnamed typedef'd
> > > structures in layout.h (see my other mail) anyways,
> >
> > Why would you want to do that? I like them just as they are...
>
> Mainly because it's a bug that gcc 3.2 accepts it without an additional
> command line switch! Secondly because I agree with Richard Henderson that
> this is gross.
I disagree that it is gross. Microsoft compilers work with it just fine.
gcc should do the same in it certainly did so fine in the past (gcc-2.96).
It was only broken later on and now apparently requires a compile switch.
This is annoying but we can just add the switch to the ntfs makefile
depending on the gcc version used by the user. Shouldn't be too hard to do
this. (Maybe we can just always add it if older gcc allow for the
switch, too.)
I like unnamed structs and unions a lot as I think they make for a very
nice abstraction and a huge shorthand when writing code. I absolutely
*despise* code like this:
ATTR_RECORD *a;
if (a->non_resident)
a->n.data_size = 0;
else
a->r.value_length = 0;
*much* nicer to have:
ATTR_RECORD *a;
if (a->non_resident)
a->data_size = 0;
else
a->value_length = 0;
I think the first case is gross where one has to invent stupid single
letter names just because the compiler is too stupid to understand which
field we want to use. It is damn obvious to the human eye and it should be
damn obvious to the compiler! And if not I consider it a shortcomming of
the compiler.
Best regards,
Anton
> gcc 3.3 (used in SuSE Linux 8.2) gave a warning so I asked on the gcc
> mailinglist and also filed a bug report:
>
> http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10225
>
> This was closed by Richard Henderson with the following comment:
>
> See Synopsis: [3.3/3.4 regression] Unnamed structs aren't handled correctly
>
> It was a bug that 3.2 accepted this. For 3.3 and beyond this
> is accepted with the -fms-extensions switch, but not otherwise.
>
> I'll admit the documentation needs clarification, but it's
> also true that you'll not find this "feature" documented
> anywhere in the 3.2 tree.
>
> In the discussion on the GCC ml rth also wrote this (quoting my mail):
>
> Please smack the ntfs folk for me please. This is gross.
>
> You can view the whole discussion starting at
>
> http://gcc.gnu.org/ml/gcc/2003-03/msg01542.html
>
> Philipp
>
> --
> Philipp Thomas <pt...@su...>
> SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nuremberg, Germany
--
Anton Altaparmakov <aia21 at cantab.net> (replace at with @)
Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/
|