[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Confuse-devel] CFG_SIMPLE_INT on 64bit machine
From: |
Martin Hedenfalk |
Subject: |
Re: [Confuse-devel] CFG_SIMPLE_INT on 64bit machine |
Date: |
Thu, 29 Apr 2010 06:31:19 +0200 |
29 apr 2010 kl. 04.16 skrev Nathan Phillip Brink:
> On Sun, Apr 25, 2010 at 06:48:41AM +0000, Carlo Marcelo Arenas Belon wrote:
>> On Sat, Apr 24, 2010 at 04:09:53PM +0200, Martin H?mberg wrote:
>>>
>>> If you consider this as a bug, then please fix it. If not, then it is
>>> worth mentioning on your website.
>>
>> agree this should be on some FAQ
>
> Howabout the following, which would show up in the API docs?
That sounds reasonably.
Ideally, the compiler should issue a warning, but liconfuse uses a void * for
the svalue field, so any type errors are cast away, unfortunately. It would be
better to use a union with proper pointer types for the simple value. Patches
welcome :-)
-martin
> diff --git a/src/confuse.h b/src/confuse.h
> index 69215b1..65b5b07 100644
> --- a/src/confuse.h
> +++ b/src/confuse.h
> @@ -384,6 +384,9 @@ extern const char __export confuse_author[];
>
> /** Initialize a "simple" integer option (see documentation for
> * CFG_SIMPLE_STR for more information).
> + * Note that confuse uses long integers, so make sure that any pointer
> + * you provide for svalue points to a long int rather than a normal int.
> + * Otherwise, you will have strange problems on 64-bit architectures.
> */
> #define CFG_SIMPLE_INT(name, svalue) \
> __CFG_INT(name, 0, CFGF_NONE, svalue, 0)
>
> --
> ohnobinki
>
> Look out for missing apostrophes!
> _______________________________________________
> Confuse-devel mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/confuse-devel