This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [patch] default homedir (was: Re: Problem withssh-keygen.exe.


At 16:46 12/7/00 +0100, Corinna Vinschen wrote:
>I'm not quite sure what line you're referring to. The code was
>like that:
>
>         char x[100];
>
>         ...
>         if (strlen(x) == 0)
>           strcpy(x, "foo");
>
>So, if the option -p wasn't given, your code relied on the
>illegal assumption that the data space of an automatic var
>is filled with 0 bytes. The result was that `passed_home_path'
>was uninitialized when `-p' wasn't given and the strlen
>returned 0 only in 1 of 256 cases...

bah, ok I see it now, I was looking at the strcpy as the
problem you were pointing to and thinking "but strcpy doesn't
care what's in the destination already, it overwrites it"...
forgetting totally the strlen call before that. I've been
thinking in java too much..... :)

>A problem of confirmed habits... and I'm definitely not free of
>them.

guilty as charged as well... I don't think there's anyone
who isn't.


in a seperate fork Earnie Boyd wrote:
>I don't find this "sloppy code" at all.  In fact I would automatically do it
>this way as it is faster to do bit boolean than byte/word comparison.  GCC
>optimizations probably make it a mute point but I've been around for a long
>time and not all compilers are as good.

like I said, in *my* opinion.... I'm an OO person and to *me* a
Boolean and an Integer are NOT interchangeable... I like strongly
typed languages and compilers that complain... we'll ok, I do *now*
a few years ago I didn't, and would in fact have done exactly what
you do for much the same reason. Too much time with the "applications"
people has warped my brain to a different way of thinking. It
all boils down to personal preferences and the task at hand. If we
were talking about embedded code that had to perform in realtime
then I'd balk at us working in a language as high as C or C++, and
that exact type of thinking is what I'd be looking for in asm code,
but we're not.



now the forces of openness
     have a powerful and
     unexpected new ally
    http://ibm.com/linux/


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]