This shouldn't happen

Nick Sabalausky SeeWebsiteToContactMe at semitwist.com
Thu Apr 26 01:44:09 PDT 2012


"H. S. Teoh" <hsteoh at quickfur.ath.cx> wrote in message 
news:mailman.2145.1335417218.4860.digitalmars-d at puremagic.com...
> 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.
>
>

Yea, I've got no problem with both (other than sometimes the fully-unaliased 
one can be really, really long.) But at the very least, the type *as used* 
needs to be shown. The unaliased form isn't bad to have too, but it's 
typically of lesser importance.

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

Heh, love it :)

(Glad it's not the 50's - I'd be accused of being a "dirty commie"!)




More information about the Digitalmars-d mailing list