On 2/8/18 1:42 PM, Ralph Doncaster wrote:
On Thursday, 8 February 2018 at 18:31:06 UTC, Walter Bright wrote:
On 2/8/2018 5:26 AM, Steven Schveighoffer wrote:
The extra data in the object file comes from the inclusion of the
hexStringImpl function, and from the template parameter (the symbol
_D3std4conv__T9hexStringVAyaa8_6465616462656566ZQBiyAa is in there as
well, which will always be larger than the actual string passed to
hexString).
I also see the data in there twice for some reason.
This is no longer the case with the PR.
import std.conv;
void test() {
__gshared immutable char[4] s = hexString!"deadbeef";
}
produces the following, with no sign of the template and the data is
there only once:
_DATA segment
_D5test24testFZ1syG4a:
db 0ffffffdeh,0ffffffadh,0ffffffbeh,0ffffffefh ;....
_DATA ends
But it looks like they are all dchar, so 4x the space vs x"deadbeef"?
I was looking at that too when I was testing the differences, but
actually, it's the same when you use x"deadbeef".
I wonder if it's an issue with how obj2asm prints it out? Surely, that
data array must be contiguous, and they must be bytes. Otherwise the
resulting code would be wrong.
-Steve