This shouldn't happen

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Apr 25 22:13:22 PDT 2012


On Thu, Apr 26, 2012 at 12:43:00AM -0400, Nick Sabalausky wrote:
> "Andrej Mitrovic" <andrej.mitrovich at gmail.com> wrote in message 
> news:mailman.2129.1335385811.4860.digitalmars-d at puremagic.com...
> > On 4/25/12, bearophile <bearophileHUGS at lycos.com> wrote:
> >> In this case what error message would you like to receive?
> >
> > The alias itself. HWND, not Typedef!(void*).
> 
> I've long been convinced that unaliasing symbols for DMD's output
> messages is a big, big mistake. It's nearly always the wrong level of
> abstraction.
[...]

Why can't we have both? Sometimes you *want* to know what's hiding
behind that alias, esp. when debugging deeply nested generic code where
this is far from obvious. For example, given this C++ code:

	typedef int* CSPTR;
	int main() {
		CSPTR p = "abc";
	}

g++ 4.6.3 gives this message:

	/tmp/test.c: In function ‘int main()’:
	/tmp/test.c:3:12: error: cannot convert ‘const char*’ to ‘CSPTR {aka int*}’ in initialization

Both the typedef name and the actual type are specified in the message,
which makes it eminently useful in both the case where you're expecting
the typedef'd name and the case where you want to know what's behind it.

I say dmd should do the same thing. There's no reason to only print one
over the other when you can just print both. Full disclosure is the best
policy when there's a problem.


T

-- 
Democracy: The triumph of popularity over principle. -- C.Bond


More information about the Digitalmars-d mailing list