Maths Question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Nuvo
    S2Forum Possessed
    • Nov 2003
    • 3827

    #16
    I'm pretty sure NULL is declared as binary zero in stdio.h isn't it?. It is (I just checked in Visual Studio), and a NULL pointer is declared as ((void *)0.

    Comment

    • Dan
      S2Forum Extremist
      • Jun 2008
      • 1242
      • Country: United Kingdom

      #17
      It's not conceptually the same thing, though. NULL might happen to be represented by 0 on a specific platform, but it doesn't have to be.

      There are platforms where 0 is a perfectly valid memory address and therefore makes for a pointer having that value to be called NULL.

      That's the reason it's declared as a constant and then that constant used, rather than directly using 0. Ideologically, NULL is the complete absense of value, but since a physical bit has to be on or off (it can't be neither - at least not in binary computing, quantum computing is a totally different ballgame) we have to pick a real value to represent NULL.

      Plus that's only when we're dealing on a low level. NULL certainly isn't the same thing as 0 to .NET managed code, PHP code or any database system. In fact, most SQL gurus would have a heart attack if you even suggested they were the same thing

      </geekery>

      Let's go drive some cars
      1993 ABY Coupe | BMW R1200 GS
      A6 3.0 TDI Quattro (aka Sonic's 'ring support/cargo vehicle )

      Comment

      • Nuvo
        S2Forum Possessed
        • Nov 2003
        • 3827

        #18
        Agreed. Let's leave it there.

        Comment

        Working...