Re: [cc65] flexible arrays, enum & bool...

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2003-08-25 11:37:38


Hi!

On Mon, Aug 25, 2003 at 11:23:10AM +0200, Christian Krüger wrote:
> I hoped that this will work, sice Uz announched the
> C99 'flexible arrys' some time ago. Did I miss something?
> Where is the mistake?

The mistake is that you didn't read the announcement:-)

    This is a maintenance release that contains bug fixes for version 2.9.1
    (see http://www.cc65.org/bugs.php for a list), but no additional features.
                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
Emphasis by me.

> After that I encountered another wish. 'Enums' have in cc65
> the size of 'ints' which is AFAIK correct, but I like to have
> more suitable 'char' enums for the 6502: Typesafeness of
> determinant values together with quick code. What about a
> small enhancement for 'char enums'?

This wouldn't be a small enhancement, but quite some work, since there is no
enum type in cc65. Enums are actually ints, and the tag values are global
constants of type int. This is compatible with the C standard. Adding a new
type would be possible, but it's more than just a "small enhancement", and
there are at least reasons to not add this now:

  1. I have enough other things to add

  2. There's a very simple workaround:

        enum {
            foo,
            bar,
            faz
        };
        typedef unsigned char foobar_t;
        foobar_t e = foo;

  3. Adding a new type would require me to touch the guts of the compiler,
     which is often rather problematic.

> Afterall I discovered that the native type 'bool' would be a
> very nice enhancement, if Uz has some spare time.. ;-)

Just include <stdbool.h>. And no, I don't have any spare time:-)

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz_at_musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-08-25 11:37:47 CEST