[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: advisory locks patch
From: |
Mark D. Baushke |
Subject: |
Re: advisory locks patch |
Date: |
Sat, 28 Aug 2004 23:42:56 -0700 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Larry Jones <lawrence.jones@ugsplm.com> writes:
> Mark D. Baushke writes:
> >
> > The problem on line 804 (and 837) is that C99 does not allow you to have
> > declarations after you have had executable code in the current scope.
>
> C99 *does* allow declarations after code, it's pre-C99 compilers (which
> are what most people have) that don't.
Ahhh... you are correct. Page xii of ISO/IEC 9899:1999 does indeed list
'mixed declarations and code' as allowed change to the first edition of
ISO/IEC 9899:1990. It seems I had overlooked that change.
Thank you for the correction.
-- Mark
btw: I also see the following in the gcc.info file for gcc 3.3.x:
| Mixed Declarations and Code
| ===========================
|
| ISO C99 and ISO C++ allow declarations and code to be freely mixed
| within compound statements. As an extension, GCC also allows this in
| C89 mode. For example, you could do:
|
| int i;
| /* ... */
| i++;
| int j = i + 2;
|
| Each identifier is visible from where it is declared until the end of
| the enclosing block.
However, older compilers will still have problems, so it probably is
better to avoid this particular kind of code if possible.
-- Mark
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (FreeBSD)
iD8DBQFBMXrw3x41pRYZE/gRAr6MAKCF2FXVdNMdE+CIfqZcEHE78l65MgCg2Xoq
2WS852kMsZdjpuYHgLM5aOg=
=6Rsh
-----END PGP SIGNATURE-----