On Sat, Jun 22, 2019 at 07:19:41AM -0700, Kevin J. McCarthy wrote:
On Sat, Jun 22, 2019 at 09:42:36AM +0200, Vincent Lefevre wrote:
IMHO, the best solution for safety would be to use a union (I think
that this would require the use of C99 designators for the MuttVars
initialization).
Okay, I
On 23Jun2019 02:28, vincent lefevre wrote:
I don't understand what you mean. -1 is *not* some magic value.
When -1 is converted to the unsigned integer type, it yields the
maximum value of the type. Thus (uintptr_t) -1 <= (unsigned long) -1
is true iff unsigned long is at least as large as uintp
On 2019-06-23 09:01:43 +1000, Cameron Simpson wrote:
> On 22Jun2019 21:14, vincent lefevre wrote:
> > On 2019-06-22 12:40:39 +0200, Oswald Buddenhagen wrote:
> > > On Sat, Jun 22, 2019 at 09:42:36AM +0200, Vincent Lefevre wrote:
> > > > p->init = (unsigned long) safe_strdup (* ((char **) p
On 23Jun2019 09:01, Cameron Simpson wrote:
So how about this:
#define UNSET_CHAR_PTR ""
and to use UNSET_CHAR_PTR instead of (uintptr_t)-1 and (unsigned
long)-1.
Actually a macro wouldn't do, particularly if the macro gets used in
another file. You'd need a static string.
char UNSET_CHA
On 22Jun2019 21:14, vincent lefevre wrote:
On 2019-06-22 12:40:39 +0200, Oswald Buddenhagen wrote:
On Sat, Jun 22, 2019 at 09:42:36AM +0200, Vincent Lefevre wrote:
> p->init = (unsigned long) safe_strdup (* ((char **) p->data));
>
> IMHO, the best solution for safety would be to use a u
On 2019-06-22 12:40:39 +0200, Oswald Buddenhagen wrote:
> On Sat, Jun 22, 2019 at 09:42:36AM +0200, Vincent Lefevre wrote:
> > p->init = (unsigned long) safe_strdup (* ((char **) p->data));
> >
> > IMHO, the best solution for safety would be to use a union (I think
> > that this would requi
On Sat, Jun 22, 2019 at 09:42:36AM +0200, Vincent Lefevre wrote:
Thus one has conversions of a pointer (char *) to unsigned long. This
is implementation-defined and can even be undefined behavior if "the
result cannot be represented in the integer type", in particular if
unsigned long is smalle
On Sat, Jun 22, 2019 at 09:42:36AM +0200, Vincent Lefevre wrote:
> p->init = (unsigned long) safe_strdup (* ((char **) p->data));
>
> IMHO, the best solution for safety would be to use a union (I think
> that this would require the use of C99 designators for the MuttVars
> initialization).