[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [MiNT] XaAES modifications and clarification
On Thu, Dec 10, 2009 at 9:28 AM, Paul Wratt <paul.wratt@gmail.com> wrote:
> I have a couple of questions:
>
> 1)
> I want to modify this "typedef enum" declaration (XA_RELATIVE in XA_TYPES.H):
>
> LT = 0, /* 0000 */ /* Top right */
> LB, /* 0001 */ /* Bottom right */
> RT, /* 0010 */ /* Top left */
> RB, /* 0011 */ /* Bottom left */
>
> CT, /* 0100 */ /* Top centred */
> CB, /* 0101 */ /* Bottom Centered */
>
> CR, /* 0110 */ /* Right centered */
> CL, /* 0111 */ /* Left centered */
>
> HLT, /* 0000 */ /* Top right */
> HLB, /* 0001 */ /* Bottom right */
> HRT, /* 0010 */ /* Top left */
> HRB, /* 0011 */ /* Bottom left */
> HCT, /* 0100 */ /* Top centred */
> HCB, /* 0101 */ /* Bottom Centered */
>
> HCR, /* 0110 */ /* Right centered */
> HCL, /* 0111 */ /* Left centered */
>
> As you can see this results in easy confusion when reading large
> volumes of data where this is used (WIN_DRAW.C)
> can someone confirm "search for and check/replace on comaprisons", or
> would there be some underlying (function) checking also required
> I will verify the L vs R reference before commencing any changes, as
> it may just be the comments that are wrong.
Well, enums are just aliases for regular numbers (the base2 comments
stop making sense at first glance from HLT). You could make yourself
another enum with better descriptive names for convenience and still
keep the old one in there until you are certain replacing it does not
break anything...
> 2)
> in a header file (XA_TYPES.H) there are some of these:
>
> struct remember_alloc; // ???
> struct remember_alloc
> {
> struct remember_alloc *next;
> void *addr;
> };
>
> what is happening here, why the double declaration (see: ???)
Not a double declaration; The "empty" statement is a declaration, the
second is a definition. A declaration (or "forward declaration") lets
the compiler know that there is code for a symbol like this somewhere
(same source file or other linked in file). Often you find them at the
top of the source while the definition follows in the code "body"
somewhere - and has the actual function.
Suggested reading:
http://publications.gbdirect.co.uk/c_book/chapter2/variable_declaration.html
and
http://publications.gbdirect.co.uk/c_book/chapter6/enums.html
Isn't c fun to learn? :)
/Kåre
(just waking up and possibly typing bullshit. lets get some coffee!)