Jump to page: 1 2
Thread overview
alias vs typedef
Apr 19, 2004
Scott Egan
Apr 19, 2004
Dave Sieber
Apr 19, 2004
J C Calvarese
Apr 19, 2004
Dave Sieber
Apr 20, 2004
Matthew
Apr 20, 2004
Dave Sieber
Apr 20, 2004
Matthew
Apr 20, 2004
Matthew
Apr 21, 2004
Walter
Apr 21, 2004
Matthew
Apr 21, 2004
Matthew
Apr 21, 2004
Walter
Apr 21, 2004
Scott Egan
Apr 21, 2004
Walter
Apr 21, 2004
Matthew
Apr 22, 2004
Walter
Apr 22, 2004
Matthew
Apr 24, 2004
Walter
May 03, 2004
Russ Lewis
May 03, 2004
Matthew
April 19, 2004
I noticed that in std.c.windows.windows the types are all defined as aliases.  Would it be better from a type safety and potential overloading point-of-view to use typedefs?


April 19, 2004
"Scott Egan" <scotte@tpg.com.aux> wrote:

> I noticed that in std.c.windows.windows the types are all defined as aliases.  Would it be better from a type safety and potential overloading point-of-view to use typedefs?

I think that each case would have to be looked at, but in general I agree - - it's always been a problem with the Windows API that so many things are C typedef's and can't be distinguished at all with overloading.

-- 
dave
April 19, 2004
In article <Xns94D0503668634dsiebersbc@63.105.9.61>, Dave Sieber says...
>
>"Scott Egan" <scotte@tpg.com.aux> wrote:
>
>> I noticed that in std.c.windows.windows the types are all defined as aliases.  Would it be better from a type safety and potential overloading point-of-view to use typedefs?
>
>I think that each case would have to be looked at, but in general I agree - - it's always been a problem with the Windows API that so many things are C typedef's and can't be distinguished at all with overloading.
>-- 
>dave

This has been brought up before. Here's part of Walter's perspective:

"One of my early thoughts was also to clean up the win32 type system. Unfortunately, most code plays fast and loose with using C typedefs mixed in with the underlying types. Microsoft's own sample code is woefully inconsistent about it. It's so much easier to just use alias for them and not worry about it. Save the clean designs for doing something new, not legacy API's." (http://www.digitalmars.com/drn-bin/wwwnews?D/15278)

I agree with Walter. It seems to me that using typedefs in the windows headers would require a lot of unrewarded effort. (But you're free to disagree.)


JC
April 19, 2004
J C Calvarese <jcc7@cox.net> wrote:

> I agree with Walter. It seems to me that using typedefs in the windows headers would require a lot of unrewarded effort. (But you're free to disagree.)

No, that actually makes sense. Once you've worked with the Win32 API and seen how sloppy it is, you're better off just leaving it as it is, and designing well for new stuff.

Thanks for the insight.

-- 
dave
April 20, 2004
It would indeed. This is an old debate, and I lost to Walter's obdurate ability to say no.

"Scott Egan" <scotte@tpg.com.aux> wrote in message news:c60g07$2ocd$1@digitaldaemon.com...
> I noticed that in std.c.windows.windows the types are all defined as aliases.  Would it be better from a type safety and potential overloading point-of-view to use typedefs?
>
>


April 20, 2004
I don't agree. I always use typedef when interfacing with Win32 (when appropriate, of course), and I've *never* had a problem, except where I ran up against an inconsistency with something already (mis-)defined in windows.d.

"J C Calvarese" <jcc7@cox.net> wrote in message news:c619f7$1csh$1@digitaldaemon.com...
> In article <Xns94D0503668634dsiebersbc@63.105.9.61>, Dave Sieber says...
> >
> >"Scott Egan" <scotte@tpg.com.aux> wrote:
> >
> >> I noticed that in std.c.windows.windows the types are all defined as aliases.  Would it be better from a type safety and potential
overloading
> >> point-of-view to use typedefs?
> >
> >I think that each case would have to be looked at, but in general I
agree -
> >- it's always been a problem with the Windows API that so many things are
C
> >typedef's and can't be distinguished at all with overloading.
> >-- 
> >dave
>
> This has been brought up before. Here's part of Walter's perspective:
>
> "One of my early thoughts was also to clean up the win32 type system. Unfortunately, most code plays fast and loose with using C typedefs mixed
in
> with the underlying types. Microsoft's own sample code is woefully inconsistent about it. It's so much easier to just use alias for them and not worry about it. Save the clean designs for doing something new, not legacy API's." (http://www.digitalmars.com/drn-bin/wwwnews?D/15278)
>
> I agree with Walter. It seems to me that using typedefs in the windows
headers
> would require a lot of unrewarded effort. (But you're free to disagree.)
>
>
> JC


April 20, 2004
"Matthew" <matthew.hat@stlsoft.dot.org> wrote:

> I don't agree. I always use typedef when interfacing with Win32 (when appropriate, of course), and I've *never* had a problem, except where I ran up against an inconsistency with something already (mis-)defined in windows.d.

Perhaps if windows.d was cleanly designed (I don't know, haven't used it yet), we actually could use typedef and be happier, which would be a win for all of us.  After all, if D can help us rope in and better control Windows, the advantages would be huge.  In the C/C++ world, it's a lost cause, IMO.

-- 
dave
April 20, 2004
"Dave Sieber" <dsieber@spamnot.sbcglobal.net> wrote in message news:Xns94D1990F5444Bdsiebersbc@63.105.9.61...
> "Matthew" <matthew.hat@stlsoft.dot.org> wrote:
>
> > I don't agree. I always use typedef when interfacing with Win32 (when appropriate, of course), and I've *never* had a problem, except where I ran up against an inconsistency with something already (mis-)defined in windows.d.
>
> Perhaps if windows.d was cleanly designed (I don't know, haven't used it yet), we actually could use typedef and be happier, which would be a win for all of us.

I believe that is doable

>  After all, if D can help us rope in and better control
> Windows, the advantages would be huge.  In the C/C++ world, it's a lost
> cause, IMO.

I have found it thus so far, especially when working with Windows APIs



April 21, 2004
To sum up, my esteemed colleague Matthew took Scott's position, and my position was I thought our energies would be better spent designing new functionality than fixing the legacy C windows api.

"Matthew" <matthew.hat@stlsoft.dot.org> wrote in message news:c641pr$nhc$1@digitaldaemon.com...
> It would indeed. This is an old debate, and I lost to Walter's obdurate ability to say no.
>
> "Scott Egan" <scotte@tpg.com.aux> wrote in message news:c60g07$2ocd$1@digitaldaemon.com...
> > I noticed that in std.c.windows.windows the types are all defined as aliases.  Would it be better from a type safety and potential
overloading
> > point-of-view to use typedefs?
> >
> >
>
>


April 21, 2004
You see, I told you -->

"Walter" <walter@digitalmars.com> wrote in message news:c65dgk$30pe$1@digitaldaemon.com...
> To sum up, my esteemed colleague Matthew took Scott's position, and my position was I thought our energies would be better spent designing new functionality than fixing the legacy C windows api.
>
> "Matthew" <matthew.hat@stlsoft.dot.org> wrote in message news:c641pr$nhc$1@digitaldaemon.com...
> > It would indeed. This is an old debate, and I lost to Walter's obdurate

                ---------  <G>
> > ability to say no.
> >
> > "Scott Egan" <scotte@tpg.com.aux> wrote in message news:c60g07$2ocd$1@digitaldaemon.com...
> > > I noticed that in std.c.windows.windows the types are all defined as aliases.  Would it be better from a type safety and potential
> overloading
> > > point-of-view to use typedefs?


« First   ‹ Prev
1 2