Re: [PHP-DEV] [PATCH] Clean up struct initalizations

2007-11-27 Thread Andy Lester
On Tue, Nov 27, 2007 at 10:30:35AM -0800, Stanislav Malyshev ([EMAIL PROTECTED]) wrote: > No, the compiler makes sure I got them all, and it does it with {0}. I can tell where this is going. I'll back away now. xoa -- Andy Lester => [EMAIL PROTECTED] => www.petdance.com => AIM:petdance -- P

Re: [PHP-DEV] [PATCH] Clean up struct initalizations

2007-11-27 Thread Stanislav Malyshev
you are quoting c99… and we are still using "c90" mode, as far as I remember I couldn't find any c90 available online for free but anyway that's long-standing practice that all compilers I know follow. gcc's own manual says: -Wmissing-field-initializers Warn if a structure's initializer

Re: [PHP-DEV] [PATCH] Clean up struct initalizations

2007-11-27 Thread Stanislav Malyshev
Not sure I see how it helps - suppose we add a field into structure, does it mean one has to go over all the code that ever mentioned this structure and add zeroes? How helpful is that? Makes sure you got them all, doesn't it? No, the compiler makes sure I got them all, and it does it with {0

Re: [PHP-DEV] [PATCH] Clean up struct initalizations

2007-11-27 Thread Alexey Zakhlestin
you are quoting c99… and we are still using "c90" mode, as far as I remember On 11/27/07, Stanislav Malyshev <[EMAIL PROTECTED]> wrote: > > a global struct is filled up with NULL/0's while a local struct is not > > initialized at all. The patch simply provides more correct code and even > > That

Re: [PHP-DEV] [PATCH] Clean up struct initalizations

2007-11-27 Thread Stanislav Malyshev
My goal here is to improve long-term maintainability of the code, by I don't see how unwrapping all structures in initializers improves maintainability. If anything, it actually makes code harder to maintain - now on any change you need to go over all the code and fix all the initializers - a

Re: [PHP-DEV] [PATCH] Clean up struct initalizations

2007-11-27 Thread Andy Lester
> Not sure I see how it helps - suppose we add a field into structure, > does it mean one has to go over all the code that ever mentioned this > structure and add zeroes? How helpful is that? Makes sure you got them all, doesn't it? xoa -- Andy Lester => [EMAIL PROTECTED] => www.petdance.com

Re: [PHP-DEV] [PATCH] Clean up struct initalizations

2007-11-27 Thread Stanislav Malyshev
Doesn't C standard mandate filling up uninitialized fields with 0? Yes. My patch is for human benefit, not the compiler's. Not sure I see how it helps - suppose we add a field into structure, does it mean one has to go over all the code that ever mentioned this structure and add zeroes? Ho

Re: [PHP-DEV] [PATCH] Clean up struct initalizations

2007-11-27 Thread Stanislav Malyshev
a global struct is filled up with NULL/0's while a local struct is not initialized at all. The patch simply provides more correct code and even That's not what I read in C standard - it says that if struct is partially initialized, the rest is zeroed out: Quoting http://c0x.coding-guideline

Re: [PHP-DEV] [PATCH] Clean up struct initalizations

2007-11-27 Thread Andy Lester
On Nov 27, 2007, at 9:57 AM, Ilia Alshanetsky wrote: There is absolutely nothing wrong with trying to make the code more maintainable, in fact I think everyone, myself included welcome any work in that direction. But at the same time we need to keep in mind that compiler is not always righ

Re: [PHP-DEV] [PATCH] Clean up struct initalizations

2007-11-27 Thread Ilia Alshanetsky
Andy, There is absolutely nothing wrong with trying to make the code more maintainable, in fact I think everyone, myself included welcome any work in that direction. But at the same time we need to keep in mind that compiler is not always right and often will generate meaningless warnings

Re: [PHP-DEV] [PATCH] Clean up struct initalizations

2007-11-27 Thread Andy Lester
On Nov 27, 2007, at 9:49 AM, Ilia Alshanetsky wrote: GCC will spue a slew of warnings that can be safely ignored and in some cases are bogus. The pedantic changes only make the code harder to read and yield very little if any benefits in return. For larger, more complex structs like zvals

Re: [PHP-DEV] [PATCH] Clean up struct initalizations

2007-11-27 Thread Ilia Alshanetsky
GCC will spue a slew of warnings that can be safely ignored and in some cases are bogus. The pedantic changes only make the code harder to read and yield very little if any benefits in return. For larger, more complex structs like zvals it'll only create a meaningless mess. There is absolut

Re: [PHP-DEV] [PATCH] Clean up struct initalizations

2007-11-27 Thread Andy Lester
On Nov 27, 2007, at 8:34 AM, Alexey Zakhlestin wrote: On 11/27/07, Ilia Alshanetsky <[EMAIL PROTECTED]> wrote: IMHO {0} is sufficiently clear for human consumption. {NULL, 0, 0} brings real structure dimensions to the context, which is good (less need to check "headers"). It also means tha

Re: [PHP-DEV] [PATCH] Clean up struct initalizations

2007-11-27 Thread Alexey Zakhlestin
On 11/27/07, Ilia Alshanetsky <[EMAIL PROTECTED]> wrote: > IMHO {0} is sufficiently clear for human consumption. {NULL, 0, 0} brings real structure dimensions to the context, which is good (less need to check "headers"). > On 27-Nov-07, at 8:49 AM, Andy Lester wrote: > > > > > On Nov 27, 2007, at

Re: [PHP-DEV] [PATCH] Clean up struct initalizations

2007-11-27 Thread Ilia Alshanetsky
IMHO {0} is sufficiently clear for human consumption. On 27-Nov-07, at 8:49 AM, Andy Lester wrote: On Nov 27, 2007, at 2:53 AM, Stanislav Malyshev wrote: I've been working on making PHP build under more stringent error checking, specifically -Wextra under GCC. This patch cleans up dozens

Re: [PHP-DEV] [PATCH] Clean up struct initalizations

2007-11-27 Thread Andy Lester
On Nov 27, 2007, at 2:53 AM, Stanislav Malyshev wrote: I've been working on making PHP build under more stringent error checking, specifically -Wextra under GCC. This patch cleans up dozens of struct initializations that are valid C, but could hide future problems. Doesn't C standard mand

Re: [PHP-DEV] [PATCH] Clean up struct initalizations

2007-11-27 Thread Marcus Boerger
Hello Stanislav, a global struct is filled up with NULL/0's while a local struct is not initialized at all. The patch simply provides more correct code and even adds a few consts. I think we should apply this to 5.3 and HEAD. Meaning we need it for both versions. marcus Tuesday, November 27, 2

Re: [PHP-DEV] [PATCH] Clean up struct initalizations

2007-11-27 Thread Stanislav Malyshev
I've been working on making PHP build under more stringent error checking, specifically -Wextra under GCC. This patch cleans up dozens of struct initializations that are valid C, but could hide future problems. Doesn't C standard mandate filling up uninitialized fields with 0? -- Stanislav Maly

[PHP-DEV] [PATCH] Clean up struct initalizations

2007-11-26 Thread Andy Lester
I've been working on making PHP build under more stringent error checking, specifically -Wextra under GCC. This patch cleans up dozens of struct initializations that are valid C, but could hide future problems. xoxo, Andy -- Andy Lester => [EMAIL PROTECTED] => www.petdance.com => AIM:petdance I