Posted By: Saturnus
Auto-initialized empty TEXT strings lack char array - 12/27/10 20:20
According to the manual page about the strings parameter of TEXT objects, "String pointers that are not defined through the string() parameter are initialized to empty strings" (http://www.conitec.net/beta/atext-strings.htm).
However, in contrast to ordinary empty strings (e.g. STRING *str = "";), such strings don't have a char array assigned initially (str->chars == 0).
This doesn't seem to be a problem in most cases.
When such a string gets copied to another string, though, a W1501 occurs.
Perhaps this could be changed?
I think it would be more convenient if auto-initialized empty TEXT strings already had a char array assigned as ordinary empty strings do.
However, in contrast to ordinary empty strings (e.g. STRING *str = "";), such strings don't have a char array assigned initially (str->chars == 0).
This doesn't seem to be a problem in most cases.
When such a string gets copied to another string, though, a W1501 occurs.
Perhaps this could be changed?
I think it would be more convenient if auto-initialized empty TEXT strings already had a char array assigned as ordinary empty strings do.
Code:
#include <acknex.h> TEXT* txt = { strings = 2; string(""); // only define the first string } void main () { printf("[0]->chars = %p\n[1]->chars = %p", ((txt->pstring)[0])->chars, ((txt->pstring)[1])->chars); str_cpy((txt->pstring)[0], (txt->pstring)[1]); // W1501 }