Imported from previous forum
I am trying to understand ASCII string representations as described in Section 10.6.3 of the Fast 1.1 Specification. I understand the difference between a NULL and an Empty string. But I cannot see why there is a distinction between an Empty string and “\0”. Am I just looking at this too much from the perspective of a C/C++ programmer (where a string with the single character ‘\0’ is the empty string)?
Are there encoding implementations that actually take advantage of this difference?
Do other C/C++ implementations attempt to distinguish between the two cases?
Thanks,
Jim Walker
RGM Advisors, LLC
From the perspective of FAST, “\0” is a string of length one, with a single character having the value zero. Null terminated strings is an artifact of certain languages as you point out and is not a concept in FAST. An empty string in FAST doesn’t contain any characters at all, not even a ‘\0’ character.
/David
I am trying to understand ASCII string representations as described in Section 10.6.3 of the Fast 1.1 Specification. I understand the difference between a NULL and an Empty string. But I cannot see why there is a distinction between an Empty string and “\0”. Am I just looking at this too much from the perspective of a C/C++ programmer (where a string with the single character ‘\0’ is the empty string)?
Are there encoding implementations that actually take advantage of this difference?
Do other C/C++ implementations attempt to distinguish between the two cases?
Thanks,
Jim Walker
RGM Advisors, LLC
Yes, this makes sense. I still wonder if there are any venues that take advantage of this distinction?
Jim Walker
From the perspective of FAST, “\0” is a string of length one, with a single character having the value zero. Null terminated strings is an artifact of certain languages as you point out and is not a concept in FAST. An empty string in FAST doesn’t contain any characters at all, not even a ‘\0’ character.
/David
It’s safe to say it isn’t common, but I think I came across a venue at one point that used zeroes to pad strings to a fixed width (which I wouldn’t recommend in the general case). Unfortunately I don’t remember which venue or feed it was.
/David
Yes, this makes sense. I still wonder if there are any venues that take advantage of this distinction?
Jim Walker
From the perspective of FAST, “\0” is a string of length one, with a single character having the value zero. Null terminated strings is an artifact of certain languages as you point out and is not a concept in FAST. An empty string in FAST doesn’t contain any characters at all, not even a ‘\0’ character.
/David
If you want to think of this from the point of view of a C++ programmer:
char * null_string = 0;
char * empty_string = “”;
FAST has different representations for these different cases.
Dale
I am trying to understand ASCII string representations as described in Section 10.6.3 of the Fast 1.1 Specification. I understand the difference between a NULL and an Empty string. But I cannot see why there is a distinction between an Empty string and “\0”. Am I just looking at this too much from the perspective of a C/C++ programmer (where a string with the single character ‘\0’ is the empty string)?
Are there encoding implementations that actually take advantage of this difference?
Do other C/C++ implementations attempt to distinguish between the two cases?
Thanks,
Jim Walker
RGM Advisors, LLC
I forgot:
char * string_containing_null = “\0”;
which can also be distinctly represented in FAST.
Yes it is rare for these capabilities to be used, but I very much appreciate the fact that the people who designed FAST didn’t say: “No one will ever want to do ‘X’ so we don’t need to support that possibility.”
Dale
(the C++ literal, by the way occupies two bytes in memory)
If you want to think of this from the point of view of a C++ programmer:
char * null_string = 0;
char * empty_string = “”;FAST has different representations for these different cases.
Dale
I am trying to understand ASCII string representations as described in Section 10.6.3 of the Fast 1.1 Specification. I understand the difference between a NULL and an Empty string. But I cannot see why there is a distinction between an Empty string and “\0”. Am I just looking at this too much from the perspective of a C/C++ programmer (where a string with the single character ‘\0’ is the empty string)?
Are there encoding implementations that actually take advantage of this difference?
Do other C/C++ implementations attempt to distinguish between the two cases?
Thanks,
Jim Walker
RGM Advisors, LLC