How do you initialize a dynamic structure that has a const data member? I can provide an ugly hack but I'm at a loss as how to do it correctly. Actually, can you do this in a platform independent way?
#include <stdio.h>
#include <stdlib.h>
struct mys
{
const int value;
};
int main(int argc, char**argv)
{
struct mys *sptr = (struct mys*)malloc(sizeof(struct mys));
*(int*)sptr = 1234;
fprintf(stdout, "ans->%d\n", sptr->value);
/*sptr->value = 67;*/
return 0;
}