>
> GCC complains when I try to initialize the structure with something like:
>
> struct validation_fun val_init[] = {
> {"init", valfun_init, 0}
> };
>
> This can be avoided by:
>
> struct validation_fun val_init[] = {
> {(char *) (uintptr_t) "init", valfun_init, 0}
> };
>
> ..but as a matter of fact, static, pre-initialized valfun structs are
> the rule rather than the exception in this program, so having this
> syntax for all of them seems.. well.. ugly :)
>
Ah.. I see..
(I don't think you need (uintptr_t) - you can cast a (const char *)
to a (char *) without having to go "through" that - I believe.)
Is this C, or C++.. there are some differences in the type of
a constant character string between the two...
But - basically, what you are trying to describe is a field which
is sometimes 'const' and othertimes isn't... which doesn't make
sense in the context of the C standard... you'll need a cast
for the initialization, or some other approach besides static
initialization I believe... (or, just "live" with the warning...
which isn't pleasant at all.)
- Dave R. -
--
[EMAIL PROTECTED] Work: (919) 676-0847
Get your mainframe programming tools at http://www.dignus.com
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message