lkml.org 
[lkml]   [2002]   [Jan]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: RFC: booleans and the kernel
    From
    Date
    le ven 25-01-2002 à 09:00, Momchil Velikov a écrit :
    > >>>>> "Alexander" == Alexander Viro <viro@math.psu.edu> writes:
    > >> > int main()
    > >> > {
    > >> > char x;
    > >> >
    > >> > if ( x )
    > >> > {
    > >> > printf ("\n We got here\n");
    > >> > }
    > >> > else
    > >> > {
    > >> > // We never get here
    > >> > printf ("\n We never got here\n");
    > >> > }
    > >> > exit (0);
    > >> > }
    > >> > covell@xxxxxx ~>gcc -Wall foo.c
    > >> > foo.c: In function `main':
    > >> > foo.c:17: warning: implicit declaration of function `exit'
    > >>
    > >> I'm lost. What do you want to prove ? (Al Viro would say you just want
    > >> to show you don't know C ;)
    > >> And why do you think you never get there ?
    >
    > Alexander> I suspect that our, ah, Java-loving friend doesn't realize that '\0' is
    > Alexander> a legitimate value of type char...
    >
    > Alexander> BTW, he's got a funny compiler - I would expect at least a warning about
    > Alexander> use of uninitialized variable.
    >
    > That warning would require data-flow analysis (reachable definitions
    > in this case), which is not enabled with certain levels of
    > optimization.

    Yes, the warning is enabled as soon as you start to optimize (-O1 and
    more), which is often the case. And if you ask for warnings, of course.

    Xav

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 13:15    [W:0.025 / U:2.592 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site