Bill Baxter wrote:
On Sun, Jan 11, 2009 at 8:23 AM, Charles Hixson
<charleshi...@earthlink.net> wrote:
Is it possible to use a typedefed variable with library classes?
In particular, what I've done is:
typedef int TestType;
TestType t;
File f;
t = 42;
f.write (t);
And the response I get is the compiler asking whether I want to write bytes
or a long.
Am I doing something grossly wrong? Or is typedef just broken? Or is it
really supposed to work that way for some not-understood reason?
(alias works fine...but this seems to make typedef basically useless. Unless
there's a way of adding functions to the library classes [like file] so that
they'll understand how to cast the typedefed variable.)
I've never found a use for typedef myself. I don't think it's used
much, so it could be that it's a special case that Andrei didn't
consider when re-writing write() [at least I'm assuming you're
talking D2, based on the error message]. Or it could be that it is a
bug with the compiler. But either way I think no one uses it, so it's
likely to flush out lots of corner cases.
--bb
Sorry. Yes, it was D2. Guess I'll just avoid it then. (Pity.)