Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

loves me some obscure error message

Name: Anonymous 2009-11-01 2:55

Ok, I've got this code (not exactly as seen here, it's much long and obviously uses real variable names etc. but I just provided the bare minimum so you can see what's going on):

void myfunc(const char *sarg)
{
        char *temp;

        temp = strtok(sarg, ".");

        /* etc.  doesn't matter what I have beyond this code */
}


I get this message:
[Warning] passing arg 1 of `strtok' discards qualifiers from pointer target type

What the hell does that mean?  I'm not too worried about it because it works fine if I just typecast sarg with (char*), but I'd like to know wtf this actually means instead of just assuming that everything will be ok as long as I typecast, since that could potentially lead to some unsafe behaviour that I can't foresee.

Name: C retardation to the extreme 2009-11-01 6:39

gcc is seriously pissing me off.  It fucking always chokes on structs that use their own type in the structure (ie. a linked list).

Right now I've got a global at the top of this source file that is a pointer to this type of struct, and somewhere in a function I declare another pointer to this struct but this time it decides that mystruct_t is UNDECLARED LOLOLOLOL.  How the fuck did it accept the previous global declaration and then decide that this time the storage type was never declared?  NOBODY KNOWS!  Spooky Halloween mystery!

I have tried EVERY FUCKING COMBINATION THAT IS FUCKING IMAGINABLE of the following:

typedef struct name_t { name_t *nextName; };
typedef struct { name_t *nextName; } name_t;
struct name_t { name_t *nextName; };
struct { name_t *nextName; } name_t;
typedef struct name_t { struct name_t *nextName; };
typedef struct { struct name_t *nextName; } name_t;
struct name_t { struct name_t *nextName; };
struct { struct name_t *nextName; } name_t;

and probably some more before I ripped my scalp off.
And I try declaring with either

name_t *llNames;
struct name_t *llNames;


Still, it always gives me either:

fuck.h [Warning] useless keyword or type name in empty declaration <-- line number is last line of struct declaration, ie. "};"
or
fuck.h [Warning] no semicolon at end of struct or union <-- line number is the struct-ptr member
fuck.h [Warning] data definition has no type or storage class[/m] <-- line number is once again for "};"

I'm getting fucking tired of this and I might have no choice but to strip this bitch down until I have only the offending code and hope the problem is still reproduceable when I've gotten rid of everything else.  Does anyone have a fucking idea why this thing is being a jewish piece of crap?

Name: Anonymous 2009-11-01 6:46

>>6
The really fucking weird thing is, this will occasionally compile without a hitch.  But I can touch something -- ANYTHING -- and suddenly it starts giving me that horse-shit again.  It just decides that the combination of crap I've fed it1 is no longer valid.  So I start diddling with the structs again and when I think it's hopeless, suddenly the stars are just right again and the fucker compiles.

-
1. What I currently have is the following:

typedef struct name_t
{
        struct name_t *nextName;
} name_t;

/* this is what my global looks like */
struct name_t *listNames;

/* this is how the declaration looks inside the function */
void somefunc(void)
{
        name_t *name = malloc(sizeof(name_t));
}

I know that as soon as I touch anything, this crap will start all over again ;_;

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List