Limitations on the Use of Strings in Unions

In Tibbo C, unions cannot include string members or member structures, whose members include strings:

Tibbo C
struct packet_x{
   unsigned char packet_type;
   string dt(20); //here is a member string

packet_x p_x; //a structure with a string member -- this is OK 


union packet{
   packet_x p_x; //this will generate an error (not a POD-type") -- packet_x has a string member

struct mega_struct{
   packet_x p_x; //this member is a structure with a string member -- this is OK

The reason for this limitation is that string variables include metadata (current length and capacity), which could potentially become invalid as a result of union manipulation (for example, it would be possible to set current length > capacity).

The related compiler error looks like this in the Output pane:

(prj)\ : error C1203: invalid union member type: 'struct p_x' is not a POD-type

"POD" stands for "plain old data." Strings contain metadata, so they are not "plain old data."