[In the original, Mogens Heller Jensen shows code that does not compile
because the typedef-name occurs after the point where it is needed.]
"John Bode" <jo*******@my-deja.com> wrote in message
news:11**********************@z14g2000cwz.googleg roups.com... struct tTkThread;
typedef struct tTkThread TkThread;
typedef void (*TkThreadProcedure)(TkThread *pThis);
struct tTkThread {
...
TkThreadProcedure pRunFunc;
};
In article <43***********************@nntp02.dk.telia.net>
Mogens Heller Jensen <mo****@mookid.dk> wrote:I tried this in MSVC7 and it works perfectly.
It should; it is valid Standard C (both the old 1989 ANSI/ISO
standard, and the new 1999 ISO standard).
But it does not work in my case - it seems the compiler is stupid/not
fully compliant with the standard. I am using the Codevision C compiler
for the Atmel Atmega16 microcontroller.
You might try another newsgroup, as this one (comp.lang.c) is all
about Standard C, so we can only tell you that this compiler appears
to be broken (although to be sure of that, we would have to have a
complete sample that fails to compile).
On the other hand, you might also try removing all the "typedef"s
entirely. Remember that in C, typedef does not define types. It
just gives you a new name for an existing type. The above
can be rewritten as:
/* think of the keyword "struct" as meaning "type"; your type is
named TkThread */
struct TkThread {
...
void (*pRunFunc)(struct TkThread *pThis);
};
All you have to do is write out the "type" keyword each time,
spelling it "wrong": "STRange spelling for User-defined abstraCt
Type", or "struct".
--
In-Real-Life: Chris Torek, Wind River Systems
Salt Lake City, UT, USA (40°39.22'N, 111°50.29'W) +1 801 277 2603
email: forget about it
http://web.torek.net/torek/index.html
Reading email is like searching for food in the garbage, thanks to spammers.