Page 1 of 1

Purpose of having both #NUL and #NULL?

Posted: Wed May 28, 2025 10:19 pm
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?

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

Posted: Wed May 28, 2025 10:24 pm
by idle
NUL is historic as in the Ascii code and besides we also have #NULL$

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

Posted: Wed May 28, 2025 11:02 pm
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.

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

Posted: Wed May 28, 2025 11:14 pm
by Quin
Fair enough, it's just stylistic then. Thanks!