[SOLVED]Macro NULL in pawn.
#1

Код:
 error 017: undefined symbol "NULL"
The macro NULL is not included in pawn? Thank you.
Reply
#2

you can do

pawn Код:
#define NULL (0)
Reply
#3

Quote:
Originally Posted by MaVe - leeturl.de
you can do

pawn Код:
#define NULL (0)
But defining this way, when I use NULL in some part of the code will not have the same result if I use the conventional NULL because NULL is a null pointer.
Reply
#4

C - ((void*)0)
C++ - (0)

Why did C defined 0 as void pointer ? Because it was used to empty pointer's address.
And by the way, there is not pointers in PAWN because no newbie will be able to learn to use it correct and there it won't be easy(for newbies) to learn.
Reply
#5

Isn't NULL \0 ?
Reply
#6

Quote:
Originally Posted by dice7
Isn't NULL \0 ?
It's called NULL because it's decimal value is (0). NULL on end of string is written like \0 to escape 0 and then it is NULL.

This is totally legal:

new char = 0;

if you do printf("%c", char) it will display nothing. The better example is C/C++ int->char casting.
Reply
#7

'\0' == 0 == 0x0 == 1-1 == false == NULL
Reply
#8

Quote:
Originally Posted by JoeBullet
C - ((void*)0)
C++ - (0)

Why did C defined 0 as void pointer ? Because it was used to empty pointer's address.
And by the way, there is not pointers in PAWN because no newbie will be able to learn to use it correct and there it won't be easy(for newbies) to learn.
Thanks JoeBullet, I understood perfectly.
And really, pointers are very boring! But it is not as complicated as many think...

Quote:
Originally Posted by MaVe - leeturl.de
'\0' == 0 == 0x0 == 1-1 == false == NULL
Thanks !

(Sorry my bad english)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)