How to set an array slot to NULL

This is a discussion on How to set an array slot to NULL within the C Programming forums, part of the General Programming Boards category; Originally Posted by itCbitC imo only difference is the precision and pedantic in this context refers puely to the degree ...

  1. #16
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,304
    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.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    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,058
    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,058
    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,058
    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.

Page 2 of 2 FirstFirst 12
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, 02:48 AM
  2. New string functions
    By Elysia in forum C Programming
    Replies: 11
    Last Post: 03-28-2009, 06:03 AM
  3. Replies: 10
    Last Post: 07-10-2008, 04:45 PM
  4. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 01:34 PM
  5. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 09:32 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21