Purpose of having both #NUL and #NULL?

Just starting out? Need help? Post your questions and find answers here.
Quin
Addict
Addict
Posts: 1132
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Purpose of having both #NUL and #NULL?

Post by Quin »

When running this code:

Code: Select all

Debug #NUL
Debug #Null
I see 0 for both values, so I assume these constants are basically the same. What's the purpose of the former, though? Nul with just one l isn't something I've seen anywhere else, although it probably exists.
Why not just have one constant though, #null?
User avatar
idle
Always Here
Always Here
Posts: 5888
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Purpose of having both #NUL and #NULL?

Post by idle »

NUL is historic as in the Ascii code and besides we also have #NULL$
User avatar
kenmo
Addict
Addict
Posts: 2043
Joined: Tue Dec 23, 2003 3:54 am

Re: Purpose of having both #NUL and #NULL?

Post by kenmo »

Sure they both compile to value 0, but the difference is just semantics and code readability.

Personally I use #NUL for the character 0x00, #Null for pointers, and 0 for a numeric 0 such as a count.
Quin
Addict
Addict
Posts: 1132
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: Purpose of having both #NUL and #NULL?

Post by Quin »

Fair enough, it's just stylistic then. Thanks!
Post Reply