Empty strings aren't really bbEmptyString
BlitzMax Forums/BlitzMax Programming/Empty strings aren't really bbEmptyString
| ||
Empty strings don't seem to point to bbEmptyString. In my other code I'm not passing the default parameter as anything and it's showing up as ""'s address, which isn't the case here (not passing the default parameter in the code below will actually use Null, which is bbEmptyString). I'm checking the length of the string instead of comparing it against bbEmptyString for now. SuperStrict Framework brl.blitz Import brl.standardio Import "test.c" Extern "c" Function teststring(str:String) End Extern Local blah:TBlah = New TBlah blah.foobar("") ' What is this pointing to? It definitely isn't bbEmptyString blah.foobar("") ' The address doesn't change, either. Maybe that's just good assembly code blah.foobar(Null) ' This points to bbEmptyString, though blah.foobar() ' And this (as expected.. though it isn't the case in my other code) blah.foobar("qwerty") Type TBlah Method foobar(str:String = Null) teststring(str) End Method End Type #include <brl.mod/blitz.mod/blitz.h> #include <stdlib.h> extern void teststring(BBString* str) { printf("str=\"%s\" str#%p, empty#%p, null#%p\n", bbTmpCString(str), str, &bbEmptyString, &bbNullObject); } Output: str="" str#0x805ef40, empty#0x805e1d0, null#0x805e2b0 str="" str#0x805ef40, empty#0x805e1d0, null#0x805e2b0 str="" str#0x805e1d0, empty#0x805e1d0, null#0x805e2b0 str="" str#0x805e1d0, empty#0x805e1d0, null#0x805e2b0 str="qwerty" str#0x805ef7c, empty#0x805e1d0, null#0x805e2b0 |