You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
localString returns a structur by value and no pointer. #1
localString returns a structur by value and no pointer. Therefore the example is wrong:
#define SIZE 40 <--- the LString can never grow longer than 39 chars
static char buff[SIZE] = "Hello";
LString *hello = localString(buff, SIZE);
...
lstringchcat(hello, " World !");
} <--- automatic deallocation at the end of the scope
Warning: The following does not work (because localString does
not allocate memory):
LString *hello = localString("Hello World", SIZE);
In my opinion it must be:
#define SIZE 40 <--- the LString can never grow longer than 39 chars
static char buff[SIZE] = "Hello";
LString hello = localString(buff, SIZE);
...
lstringchcat(&hello, " World !");
} <--- automatic deallocation at the end of the scope
Warning: The following does not work (because localString does
not allocate memory):
LString hello = localString("Hello World", SIZE);
changed the title [-]localString returns a structur by value an no pointer.[/-][+]localString returns a structur by value and no pointer.[/+]on Feb 10, 2024
Activity
[-]delString is not setting string to NULL[/-][+]localString returns a structur by value an no pointer.[/+][-]localString returns a structur by value an no pointer.[/-][+]localString returns a structur by value and no pointer.[/+]