Page 1 of 1

String = Null

PostPosted: Sun Jan 20, 2013 9:49 am
by Slowdown
When reading a String from Empty Dictionary the String is Null.
Is this correct ? shouldn't the String be empty ("") ?

Re: String = Null

PostPosted: Sun Jan 20, 2013 11:55 am
by Henning
That is one of the "uninitialized" variable gotchas. I was caught by that earlier.

I remember I've seen that reading past end of a Dictionary IS returning a Null-string. My 5 cents is that it's some C++ spillover. There is a lot of C++ in the Q7b syntax...

/Henning

Re: String = Null

PostPosted: Sun Jan 20, 2013 1:47 pm
by Slowdown
Hi Henning,
reading past end of a Dictionary

In that case i understand it.
In VB6 (in the past) when i forced an application to read after the end of a randomfile created by the same application
it returned garbage.
In this case i do the following,
In Global
Code: Select all
Public Type TypeAppConfig
  SourceDir As String
  DestDir As String
  Priority As Integer
End Type

In some module when the file doesn't excist
Code: Select all
    Config.Priority = 3
    Config.SourceDir = ""
    Config.DestDir = ""

Save the value's and read them back.
The two string values shouldn't be Null in this case.
Edit::
Strings are indeed set to Null in the dictionary.
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<V1.0>
    <dictionary>
        <key>SyncdirSettings</key>
        <type>
            <count>3</count>
            <null></null>
            <null></null>
            <integer>2</integer>
        </type>
    </dictionary>
</V1.0>

Re: String = Null

PostPosted: Sun Jan 20, 2013 2:20 pm
by Henning
This smells like the known problem with Public Types in Global, and Arrays too...

My guess is that if the Type is declared in the same Module it will work. ;)

/Henning

Re: String = Null

PostPosted: Mon Jan 21, 2013 8:02 pm
by Slowdown
Will test this if i have some time.
At this moment i have an application with unexpected behavior and can't find the problem :evil:
Is there a place on the forum where i can shout a lot of nasty words, to curse so i can relieve me from some frustations :?

Re: String = Null

PostPosted: Tue Jan 22, 2013 8:29 pm
by Slowdown
pfffff at last solved.
no it doesn't belong here sorry.

Re: String = Null

PostPosted: Tue Jan 22, 2013 9:19 pm
by Henning
:D

/Henning