Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Integer overflow during brace expansion



On Thu, Mar 1, 2012 at 6:30 AM, Peter Stephenson
<Peter.Stephenson@xxxxxxx>wrote:

> +   long long foo = (long long)400;
> +   char buf[20];
> +   sprintf(buf, "before%lldafter", foo);
> +   if (!strcmp(buf, "before400after")) {
>

I think it'd be nice to get some higher bits involved in that check.
 Perhaps something like this:

    long long foo = ((long long)0xdead << 40) | 0xf00d;

compares to before62677660341432333after (and needs a larger buf).

..wayne..


Messages sorted by: Reverse Date, Date, Thread, Author