[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: regex compile warnings
From: |
Eric Blake |
Subject: |
Re: regex compile warnings |
Date: |
Sat, 29 Jul 2006 07:11:00 -0600 |
User-agent: |
Thunderbird 1.5.0.5 (Windows/20060719) |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Paul Eggert on 7/28/2006 5:48 PM:
>>
>> "../../lib/regex_internal.h", line 714: warning: token-less macro argument
>
> This one is worth fixing, since the code does not conform to C89.
Fix checked in.
>> "../../lib/regexec.c", line 1412: warning: non-constant initializer: op "--"
>
> I don't understand this one. Here's the line in question:
>
> Idx num = --fs->num;
>
> and I assume Idx is size_t, which is a 32-bit unsigned integer, so this
> code should be perfectly fine C89. Am I missing something? It appears
> to me to be a compiler bug.
I don't have the actual C89 or C99 standards in front of me at the moment,
but this line in the C99 draft explains it:
6.7.8 Initialization
[#2] No initializer shall attempt to provide a value for an
object not contained within the entity being initialized.
I believe it is a gcc extension that allows you to change the value of an
unrelated variable inside an initializer. The workaround is trivial -
separate the assignment into a followon statement.
- --
Life is short - so eat dessert first!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFEy15k84KuGfSFAYARArsAAJ9KLPpfXEzg1iLr1smme+rZbQbkEgCgwpMd
2IsO98+Ym2m/pLCgsH+SOLM=
=6BLj
-----END PGP SIGNATURE-----