Hi, this sort of problems existed for ever in vala, another example:
// ---- cut here ----
class Test
{
int one_method()
{
return 0;
}
}
class TestOne
{
int method()
{
return 1;
}
}
// ---- cut here ----
My way of avoiding such clashes is to know how vala names are
translated to C names ;)
best regards,
AW.
>Hi,
>
>I have a simple Vala program
>
>public struct Struct { string name; }
>public enum Type { STRUCT }
>
>
>It looks fine, but if you try to compile it fails with following error:
>
>
>--------------------------------
>$ CC=clang valac a.vala
>/usr/local/google/home/anatol/sources/learning/vala/a.vala.c:22:2:
>error: expected '}'
> TYPE_STRUCT
> ^
>/usr/local/google/home/anatol/sources/learning/vala/a.vala.c:11:21:
>note: instantiated from:
>#define TYPE_STRUCT (struct_get_type ())
> ^
>/usr/local/google/home/anatol/sources/learning/vala/a.vala.c:21:15:
>note: to match this '{'
>typedef enum {
> ^
>/usr/local/google/home/anatol/sources/learning/vala/a.vala.c:75:38:
>error: initializer element is not a compile-time
> constant
> static const GEnumValue values[] = {{TYPE_STRUCT,
>"TYPE_STRUCT", "struct"}, {0, NULL, NULL}};
>
>^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>3 diagnostics generated.
>error: cc exited with status 256
>Compilation failed: 1 error(s), 0 warning(s)
>----------------------------------
>
>
>The problem here a name clash in generated Vala code - TYPE_STRUCT
>both generated as type of Struct
>
>#define TYPE_STRUCT (struct_get_type ())
>
>and as a enum value
>
>typedef enum {
> TYPE_STRUCT
>} Type;
>
>
>what is the best way to avoid such clashes? Is it possible to change
>enum names to something else. I can change enum name from Type to
>something else e.g. RecordType, but I would like to know if there is a
>better solution.
>_______________________________________________
>vala-list mailing list
>[email protected]
>http://mail.gnome.org/mailman/listinfo/vala-list
--
Mój klucz publiczny o identyfikatorze 1024D/E12C5A4C znajduje się na
serwerze hkp://keys.gnupg.net
My public key with signature 1024D/E12C5A4C is on the server
hkp://keys.gnupg.net
signature.asc
Description: PGP signature
_______________________________________________ vala-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/vala-list
