Re: [Annoyance] "git log .." thinks ".." is ambiguous

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Joshua Juran <jjuran@xxxxxxxxx> writes:

> My recollection is that Metrowerks C will statically allocate read-
> write storage (duplicating the read-only copy of the string) and copy
> the string into it at runtime.  It only copies the string once, which
> is ensured by checking an internally generated flag (also statically
> allocated) every time the scope containing the declaration is
> executed.  This is the pessimization I speak of.

That's a stupid compiler, isn't it?  Doesn't it pay attention to the fact
that the static char string in the function scope also says "const"?

A sane compiler would store { 'H' 'E' 'A' 'D' '\0' } five bytes in a data
segment (preferrably ro), give it a label and turn its assignment to and
comparison with "next" and "this" to a reference to that label address,
and all can be resolved by the linker.  Your suggestion will give a
compiler an excuse to allocate an extra pointer variable to hold that
address in addition to that, espcially if you do not say const twice.

Of course the extra pointer could be optimized away if you follow the data
and if the compiler does so we would get the same code.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]