Hello,
just because I found a nice jargon entry, which supports
my view, I relate to that old topic again.
On Wed, Apr 21, 2010 at 12:33:15PM +0200, Oliver Bandel wrote:
[...]
> I would do EVERY pointer set to NULL, when defining it.
> And normally I also would set ANY other value to a certain v
hehe,
the segfault did not came from the char* mytext,
but from wrong indexing in the vector. :(
my fault :(
Heheh... nevertheless valgrind is on my side ;-)
Somehow I got no crash from the uninitialized char*,
but that might only happen after release at the user's computer:
It's unpredic
Am Freitag, 23. April 2010 schrub Oliver Bandel:
> Zitat von "Tor Lillqvist" :
> >> You are right, that in some seldom situations it might make sense
> >> to initialize values to other start values. But they should always be
> >> predictable.
> >
> > You didn't get the reasoning about letting the c
Zitat von "Tor Lillqvist" :
You are right, that in some seldom situations it might make sense
to initialize values to other start values. But they should always be
predictable.
You didn't get the reasoning about letting the compiler, or valgrind,
catch use of uninitialized variables, did you?
Zitat von "Torsten Neuer" :
> Am Freitag, 23. April 2010 08:39:52 schrieb Oliver Bandel:
>> Zitat von "Sven Neumann" :
>> > Hi,
>> >
>> > On Thu, 2010-04-22 at 14:38 +0200, Fredrik Alströmer wrote:
>> >> For the record, I'm not necessarily against setting a predefined value
>> >> to variables some
Zitat von "Tor Lillqvist" :
>> You are right, that in some seldom situations it might make sense
>> to initialize values to other start values. But they should always be
>> predictable.
>
> You didn't get the reasoning about letting the compiler, or valgrind,
> catch use of uninitialized variables
Am Freitag, 23. April 2010 08:39:52 schrieb Oliver Bandel:
> Zitat von "Sven Neumann" :
> > Hi,
> >
> > On Thu, 2010-04-22 at 14:38 +0200, Fredrik Alströmer wrote:
> >> For the record, I'm not necessarily against setting a predefined value
> >> to variables sometimes. I'm just against doing it for
> Will the compiler stop execution on any warning? It should, and not
> compile any code that gives warnings, otherwise your attempt will not
> work. People will ignore it "just for testing".
That depends on the project. Many projects do use flags like -Werror,
although that is not always possible
> You are right, that in some seldom situations it might make sense
> to initialize values to other start values. But they should always be
> predictable.
You didn't get the reasoning about letting the compiler, or valgrind,
catch use of uninitialized variables, did you?
> The same is here: a NU
Zitat von "Sven Neumann" :
> Hi,
>
> On Thu, 2010-04-22 at 14:38 +0200, Fredrik Alströmer wrote:
>
>> For the record, I'm not necessarily against setting a predefined value
>> to variables sometimes. I'm just against doing it for the wrong
>> reasons, and I'd much rather have the compiler say "War
Hi Frederik,
my main attend was to mention the problem of pointers, regarding
uninitialized values. That's why I insisted on Null, and it makes
sense often to use 0 or 0.0 for other values.
As "strings" are char*, NULL should be used, not "".
You are right, that in some seldom situations it
Zitat von "Sven Neumann" :
> On Wed, 2010-04-21 at 18:30 +0200, Martin Nordholts wrote:
>> On 04/21/2010 01:58 PM, Oliver Bandel wrote:
>> > Even only temporarily valies, if set to a certain value,
>> > like 0 or NULL, will help in finding problems.
>>
>> I agree, and I try to initialize all local
Hi,
On Thu, 2010-04-22 at 14:38 +0200, Fredrik Alströmer wrote:
> For the record, I'm not necessarily against setting a predefined value
> to variables sometimes. I'm just against doing it for the wrong
> reasons, and I'd much rather have the compiler say "Warning: might be
> used uninitialized i
On Wed, 2010-04-21 at 18:30 +0200, Martin Nordholts wrote:
> On 04/21/2010 01:58 PM, Oliver Bandel wrote:
> > Even only temporarily valies, if set to a certain value,
> > like 0 or NULL, will help in finding problems.
>
> I agree, and I try to initialize all local variables that I either add
> or
On Thu, Apr 22, 2010 at 14:00, Oliver Bandel wrote:
> Zitat von "Fredrik Alströmer" :
>> And no valgrind, or
>> static analyzers will notice that you're reading an uninitialized
>> zero.
>
> No problem.
>
> You have that defined value, and with each run it gives you the same value.
> That mean: th
Zitat von "Fredrik Alströmer" :
> A couple of very small coins.
>
> On Thu, Apr 22, 2010 at 06:55, Martin Nordholts wrote:
>> On 04/22/2010 03:54 AM, Marc Lehmann wrote:
>>> On Wed, Apr 21, 2010 at 08:14:33PM +0200, Martin
>>> Nordholts wrote:
The compiler doesn't catch all cases, like th
A couple of very small coins.
On Thu, Apr 22, 2010 at 06:55, Martin Nordholts wrote:
> On 04/22/2010 03:54 AM, Marc Lehmann wrote:
>> On Wed, Apr 21, 2010 at 08:14:33PM +0200, Martin
>> Nordholts wrote:
>>> The compiler doesn't catch all cases, like this one:
>>>
>>> #include
>>> int main(int a
On 04/22/2010 03:54 AM, Marc Lehmann wrote:
> On Wed, Apr 21, 2010 at 08:14:33PM +0200, Martin Nordholts
> wrote:
>> The compiler doesn't catch all cases, like this one:
>>
>> #include
>> int main(int argc, char **argv)
>> {
>> int var;
>> if (argc == 2)
>> var = 42;
>> printf (
On 04/21/2010 11:45 PM, Oliver Bandel wrote:
> Zitat von "Martin Nordholts":
>
>> On 04/21/2010 01:58 PM, Oliver Bandel wrote:
>>> Even only temporarily valies, if set to a certain value,
>>> like 0 or NULL, will help in finding problems.
>>
>> I agree, and I try to initialize all local variables t
Zitat von "Sven Neumann" :
> On Wed, 2010-04-21 at 12:33 +0200, Oliver Bandel wrote:
>
>> Example:
>>
>>
>> ==
>> /*/
>> /* public functions
>> *
Zitat von "Martin Nordholts" :
> On 04/21/2010 01:58 PM, Oliver Bandel wrote:
>> Even only temporarily valies, if set to a certain value,
>> like 0 or NULL, will help in finding problems.
>
> I agree, and I try to initialize all local variables that I either add
> or modify the declaration of. I d
Hi,
Zitat von "Omari Stephens" :
> On 04/21/2010 11:58 AM, Oliver Bandel wrote:
>> Zitat von "Tor Lillqvist":
>>
[...]
>> Even only temporarily valies, if set to a certain value,
>> like 0 or NULL, will help in finding problems.
>>
>> The mentioned function just was an example.
>>
>> Uninitial
Zitat von "Sven Neumann" :
> On Wed, 2010-04-21 at 12:33 +0200, Oliver Bandel wrote:
>
>> Example:
>>
>>
>> ==
>> /*/
>> /* public functions
>> *
On Wed, 2010-04-21 at 12:33 +0200, Oliver Bandel wrote:
> Example:
>
>
> ==
> /*/
> /* public functions
> /
>
> Gim
On 04/21/2010 07:53 PM, Sven Neumann wrote:
> On Wed, 2010-04-21 at 13:58 +0200, Oliver Bandel wrote:
>
>> Even only temporarily valies, if set to a certain value,
>> like 0 or NULL, will help in finding problems.
>
> Should be totally un-necessary as the compiler will warn you if your
> code uses
On Wed, 2010-04-21 at 13:58 +0200, Oliver Bandel wrote:
> Even only temporarily valies, if set to a certain value,
> like 0 or NULL, will help in finding problems.
Should be totally un-necessary as the compiler will warn you if your
code uses uninitialized variables. We are compiling with -Wall a
On 04/21/2010 01:58 PM, Oliver Bandel wrote:
> Even only temporarily valies, if set to a certain value,
> like 0 or NULL, will help in finding problems.
I agree, and I try to initialize all local variables that I either add
or modify the declaration of. I don't think it would be worth to commit
On 04/21/2010 11:58 AM, Oliver Bandel wrote:
> Zitat von "Tor Lillqvist":
>
>>> The test
>>>if( template )
>>> makes only sense, if you can be sure that uninitialzed values
>>> will definitelky be NULL.
>>
>> You must have missed the g_return_val_if_fail (! template ||
>> GIMP_IS_CONTEXT (templ
Zitat von "Tor Lillqvist" :
>> The test
>> if( template )
>> makes only sense, if you can be sure that uninitialzed values
>> will definitelky be NULL.
>
> You must have missed the g_return_val_if_fail (! template ||
> GIMP_IS_CONTEXT (template), NULL) .
>
> It checks if template is NULL or a po
> The test
> if( template )
> makes only sense, if you can be sure that uninitialzed values
> will definitelky be NULL.
You must have missed the g_return_val_if_fail (! template ||
GIMP_IS_CONTEXT (template), NULL) .
It checks if template is NULL or a pointer to a valid GimpContext. If
template
Hello,
since some days I'm browsing through the Gimp-Code.
What I have seen so far looks very tidy.
But I also found some things that I would do differently, throughout
the whole code, and maybe also in the libs (I didn't looked at them in
detail).
I would do EVERY pointer set to NULL, whe
31 matches
Mail list logo