lkml.org 
[lkml]   [2007]   [Mar]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: Style Question
    From
    Date
    On Sun, 2007-03-11 at 22:15 +0800, Cong WANG wrote:
    [...]
    > Another question is about NULL. AFAIK, in user space, using NULL is
    > better than directly using 0 in C. In kernel, I know it used its own
    > NULL, which may be defined as ((void*)0),

    Userspace has the usually same definition.

    > but it's _still_ different
    > from raw zero.

    It is different that "0" as such has the type "int". But this int is
    automatically promoted to a "0 pointer".

    > So can I say using NULL is better than 0 in kernel?

    Yes, because it is immediately clear that a pointer is (or should be)
    there (and not an int).
    And the same holds for userspace since this is a pure C question.

    Bernd
    --
    Firmix Software GmbH http://www.firmix.at/
    mobil: +43 664 4416156 fax: +43 1 7890849-55
    Embedded Linux Development and Services

    -
    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: 2007-03-11 15:25    [W:0.021 / U:31.584 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site