return (double) SPEC_CVAL (val->etype).v_ulong;
}
+ if (SPEC_NOUN (val->etype) == V_VOID) {
+ return (double) SPEC_CVAL (val->etype).v_ulong;
+ }
+
// we are lost !
werror (E_INTERNAL_ERROR, __FILE__, __LINE__,
"floatFromVal: unknown value");
}
// -(unsigned 3) now really is signed
SPEC_USIGN(val->etype)=0;
+ // -(unsigned char)135 now really is an int
+ if (SPEC_NOUN(val->etype) == V_CHAR) {
+ if (SPEC_CVAL(val->etype).v_int < -128) {
+ SPEC_NOUN(val->etype) = V_INT;
+ }
+ }
return val;
}
int
getNelements (sym_link * type, initList * ilist)
{
- sym_link *etype = getSpec (type);
int i;
if (!ilist)
/* if type is a character array and there is only one
(string) initialiser then get the length of the string */
- if (IS_ARRAY (type) && IS_CHAR (etype) && !ilist->next)
+ if (IS_ARRAY (type) && IS_CHAR (type->next) && !ilist->next)
{
ast *iast = ilist->init.node;
value *v = (iast->type == EX_VALUE ? iast->opval.val : NULL);
if (!v)
{
- werror (W_INIT_WRONG);
+ werror (E_CONST_EXPECTED);
return 0;
}
i++;
ilist = ilist->next;
}
-
return i;
}