Thread: guc variables flags explicitly initialisation

guc variables flags explicitly initialisation

From
Fabien COELHO
Date:
Dear patchers,

One more of my 'very simple' patch serie.

please find attached a large but simple patch that insures that all guc
variables flags are explicitly set, instead of relying on the default
behavior of static variable area to be filled with zeros.

I thought falsely that there was a bug because of this so I developed the
patch. In fact the bug was in my code.

Anyway, as the patch is ready, I submit it anyway, as it seems reasonnable
to me to do so. It validates for me against current cvs head.

Have a nice day,

--
Fabien Coelho - coelho@cri.ensmp.fr

Attachment

Re: guc variables flags explicitly initialisation

From
Tom Lane
Date:
Fabien COELHO <coelho@cri.ensmp.fr> writes:
> please find attached a large but simple patch that insures that all guc
> variables flags are explicitly set, instead of relying on the default
> behavior of static variable area to be filled with zeros.

This seems entirely pointless.  Why should we add a large amount of
noise to these table definitions to avoid relying on standard C behavior?

            regards, tom lane

Re: guc variables flags explicitly initialisation

From
Fabien COELHO
Date:
Dear Tom,

> > please find attached a large but simple patch that insures that all guc
> > variables flags are explicitly set, instead of relying on the default
> > behavior of static variable area to be filled with zeros.
>
> This seems entirely pointless.  Why should we add a large amount of
> noise to these table definitions to avoid relying on standard C behavior?

Sure.

As I wrote in the mail, I had a bug in another development I suspected it
could be the source of the problem, hence I tried to fix it that way. Once
it was written, and after I found my stupid bug elsewhere, I felt that I
could sent it anyway.

It is a personnal stylistic taste that I don't like too much of implicit
things in code, such as relying of default initialisation of static
variables, as the same behavior cannot be expected for heap and stack
variables. Also, I don't like a not written 0 to have an implicit
semantics everywhere. Moreover such implicit things do not help me
understand the source code when I need to.

If you want to reduce what you call noise, you can drop NULL everywhere
at the end of the struct as they are as 'pointless'. I wouldn't do it.

Anyway, if you don't like it, you reject it and it is fine with me.

BTW, maybe you could either accept/discuss/reject some other 'small'
patches I submitted earlier, if you have some time. They are not cosmetic
as this one.

Have a nice day,

--
Fabien Coelho - coelho@cri.ensmp.fr