not initialized string should point to ""-constant
Posted: Thu May 19, 2011 9:21 pm
As part of the current threads (german forum and here) and because non
of them has requested it jet.
original idea by Nic The Quick: http://www.purebasic.fr/german/viewtopi ... 9&start=20
free translation by me
PureBasic handles null-strings as special cases. But if you are using the pointer
of such a string, you will get a null-pointer-error. Of course, you need to
handle this behavior as a special case, too. Because PureBasic handles a
null-string as an empty string in any other cases, it is much better, that there
are no null-strings. Of course, it would be really bad if PB would allocate
memory for the null-byte for every new string. But why can't it point to a
null-character-constant? If PB would create a null-character-constant and would
point every not initialized string to it, then no string-pointer would return NULL
and still it is not needed to allocate memory for not initialized strings. It could
be, that it is only needed to change the special case value from "null" to
"null-character-constant-pointer", if you understand what i mean
MFG PMV
of them has requested it jet.
original idea by Nic The Quick: http://www.purebasic.fr/german/viewtopi ... 9&start=20
free translation by me

PureBasic handles null-strings as special cases. But if you are using the pointer
of such a string, you will get a null-pointer-error. Of course, you need to
handle this behavior as a special case, too. Because PureBasic handles a
null-string as an empty string in any other cases, it is much better, that there
are no null-strings. Of course, it would be really bad if PB would allocate
memory for the null-byte for every new string. But why can't it point to a
null-character-constant? If PB would create a null-character-constant and would
point every not initialized string to it, then no string-pointer would return NULL
and still it is not needed to allocate memory for not initialized strings. It could
be, that it is only needed to change the special case value from "null" to
"null-character-constant-pointer", if you understand what i mean

MFG PMV