Thread: How to set an array slot to NULL

  1. #16
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by itCbitC
    imo only difference is the precision and pedantic in this context refers puely to the degree of precision.
    As stated in the standard, NULL as defined in <stddef.h> is implementation defined. If the implementation defines NULL as ((void*)0), then NULL is ((void*)0). There is nothing generally "more" pedantic about defining NULL as ((void*)0L).

    By the way, do you read your private messages? I was hoping to have this discussion with you via PM since it adds little to the discussion, though kotoko might be able to benefit.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  2. #17
    Registered User
    Join Date
    Oct 2008
    Location
    TX
    Posts
    2,059
    Quote Originally Posted by laserlight View Post
    As stated in the standard, NULL as defined in <stddef.h> is implementation defined. If the implementation defines NULL as ((void*)0), then NULL is ((void*)0). There is nothing generally "more" pedantic about defining NULL as ((void*)0L).

    By the way, do you read your private messages? I was hoping to have this discussion with you via PM since it adds little to the discussion, though kotoko might be able to benefit.
    agree for the benefit of the OP we should take it offline
    btw i replied to your PM so whenever you get a chance...

  3. #18
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by itCbitC View Post
    agree for the benefit of the OP we should take it offline
    btw i replied to your PM so whenever you get a chance...
    Quote Originally Posted by Microsoft Visual Studio
    Code:
    #ifndef NULL
    #ifdef  __cplusplus
    #define NULL    0
    #else
    #define NULL    ((void *)0)
    #endif
    #endif
    No L there..

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  4. #19
    Registered User
    Join Date
    Oct 2008
    Location
    TX
    Posts
    2,059
    Code:
    #if defined(_ANSI_NULL_POINTER) && defined(__STDC__)
       #define NULL ((void *)0L)
    #else
       #define NULL 0L
    #endif

  5. #20
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by itCbitC View Post
    Code:
    #if defined(_ANSI_NULL_POINTER) && defined(__STDC__)
       #define NULL ((void *)0L)
    #else
       #define NULL 0L
    #endif
    Yes, I was just proving the point, just like you are - where is that from?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  6. #21
    Registered User
    Join Date
    Oct 2008
    Location
    TX
    Posts
    2,059
    Quote Originally Posted by matsp View Post
    Yes, I was just proving the point, just like you are - where is that from?

    --
    Mats
    that code snippet has been taken from an IRIX w/s.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help Debugging my AVL tree program.
    By Nextstopearth in forum C Programming
    Replies: 2
    Last Post: 04-04-2009, 01:48 AM
  2. New string functions
    By Elysia in forum C Programming
    Replies: 11
    Last Post: 03-28-2009, 05:03 AM
  3. Replies: 10
    Last Post: 07-10-2008, 03:45 PM
  4. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  5. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 09:32 AM

Tags for this Thread