https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92659

--- Comment #3 from Xi Ruoyao <xry111 at mengyan1223 dot wang> ---
(In reply to Jonny Grant from comment #2)
> (In reply to Xi Ruoyao from comment #1)
> > Is it appropriate?
> > 
> > Though on both 32-bit and 64-bit x86 "1ul" is good for a size_t, but I
> > believe there is some platform where "1ull" is necessary.
> > 
> > Maybe I'm wrong.  But if I'm correct, suggesting "1ul" is encouraging bad
> > code.  I'll use "(size_t) 1 << 32" for this.
> 
> UL means Unsigned Long, so if that type is also 64bit like size_t, then it
> is fine.

That is true on *your platform*.

I can't find any specification in C standard saying "the bitwidth of long
should >= the bitwidth of size_t".  So at least theoretically it may be
insufficient.

Writing unportable thing is OK (if you don't care about other platforms) but
*suggesting* unportable thing is bad.

Reply via email to