I have code that works on Windows, but now that I am porting to a MAC, using Xcode 3.2.5 C/C++ Compiler Version GCC 4.2, it crashes.
I have narrowed it down to a memset call. If I comment out the memset it works, and if I put it back in the code crashes.
I have a structure that looks like this in my header file:
typedef struct 
{
    int deviceCount;
    struct 
    {
        #define MAX_DEVICE_ID 256
        #define MAX_DEVICE_ENTRIES 10
        std::string deviceId;   // Device name to Open
        TransportType   eTransportType;
    } deviceNodes[MAX_DEVICE_ENTRIES];
} DeviceParams;
Then in a cpp file I have this:
DeviceParams Param;
memset(&Param, nil, sizeof(Param));
... later I have this:
pParam->deviceNodes[index].deviceId = "some string"; // <----- Line that crashes with memset
Like I said before if I remove the memset call everything works fine. If I look at the debugger before I call the memset my strings in the structure are \0 and after the memset they are nil.
Why does the nil string crash on a assignment line and only on a MAC?
Thanks.
 
     
     
    