On Thu, Aug 10, 2006 at 03:07:08PM -0400, Michael Surette wrote: > Bob Rossi wrote: > > > On Thu, Aug 10, 2006 at 02:00:59PM -0400, Michael Surette wrote: > >> It's been a while since I've written any C code, so please forgive me if > >> this is a newbie type question. > >> > >> I was having a problem with a larger program when I ran into a problem. > >> The following code snippet should work according to what I remember of C. > >> What's wrong with it? > >> > >> ------------ > >> > >> char * color; > >> char * r="red"; > >> color = r; > > > > Is that at the global scope? You can't make assignments in the global > > scope unless they are definitions as well. Try putting that code in a > > function scope. > > > > Bob Rossi > > Thanks for the quick response. That fixed it. That would be one of those > many changes to the C language over the years I guess. What threw me off > was that it compiled fine for my brother, who runs a Windows based > compiler. > > As I mentioned in my original posting, I wrote that snippet because I was > having a problem with a larger program, a glue program between lua and > sendmail's milter interface. Perhaps you can help me with that? > > I have a function defined as... > > static sfsistat callback(SMFICTX *ctx, char *cbname, char *cbargs[]); > > later in the code, I call it (one of many times)... > > return callback(ctx, "helo", {helohost,NULL}); I'm just guessing, but if you do char *tmp[] = {"helohost", NULL}; and then call it like return callback(ctx, "helo", tmp); it might work. This might be off topic for the gcc mailing list. Bob Rossi