avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] C Preprocessor question


From: Larry Barello
Subject: [avr-gcc-list] C Preprocessor question
Date: Sat, 10 Sep 2005 17:17:20 -0700

Can I define a macro that defines some stuff? I cannot get the following to
work

#define mymacro(foo, somenumber) \
#define foo (*(pFifo)foo##bar) \
Static uint8_t foo##bar[somenumber + sizeof(Fifo)]

The goal (maybe there is a better way...) is to have a variable length
buffer with some defined structure in the front.  A pointer to the struct is
passed around various routines.  

I could use a union: 

#define mymacro(foo, somenumber) \
Union {uint8_t buf[somenumber + sizeof(Fifo)]; Fifo fifo;} foo

And the user would have to use "&foo.fifo" as the reference, but I would
prefer to just type in "&foo" when calling routines.
----
Larry Barello
www.barello.net 






reply via email to

[Prev in Thread] Current Thread [Next in Thread]