On Saturday, 11 January 2014 at 00:45:20 UTC, Mike wrote:
In the following code:module trace; private nothrow pure void SendCommand(in int command, in void* message) { asm { "mov r0, %[cmd]; mov r1, %[msg]; bkpt #0xAB" : : [cmd] "r" command, [msg] "r" message : "r0", "r1"; }; } private static nothrow pure void SendMessage(in void* ptr, in uint length) { // Create semihosting message message uint[3] message = [ 2, // stderr cast(uint)ptr, // ptr to string length // size of string ]; // Send semihosting command SendCommand(0x05, &message); } struct Trace { static nothrow pure void Write(in string text) { SendMessage(text.ptr, text.length); } static nothrow pure void Write(uint value) { char[32] buffer; char* p = buffer.ptr + 31; do { p--; *p = '0' + (value % 10); value /= 10; } while(value > 0); SendMessage(p, (buffer.ptr + 31) - p); } static nothrow pure void Write(A...)(A a) { foreach(t; a) { Write(t); } } static nothrow pure void WriteLine(A...)(A a) { foreach(t; a) { Write(t); } Write("\r\n"); } } GDC doesn't catch the ambiguity between... static nothrow pure void Write(A...)(A a) and static nothrow pure void Write(in string text) ... but LDC does. Who's right?
LDC the LLVM D compiler (0.12.1): based on DMD v2.063.2 and LLVM 3.3 GDC arm-none-eabi-gdc (GCC) 4.8.2 Copyright (C) 2013 Free Software Foundation, Inc. Also, is there a way to know which version of DMD GDC is based on?
