www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - typedef '?

reply "seany" <seany uni-bonn.de> writes:
is typedef gone?
http://forum.dlang.org/thread/aqsjjrtzfzslcopabqgs forum.dlang.org?page=2

so If I want to define a new type as typedef string[] 
surrealNumber, then it does not work?
Nov 20 2013
next sibling parent reply "evilrat" <evilrat666 gmail.com> writes:
On Wednesday, 20 November 2013 at 10:49:19 UTC, seany wrote:
 is typedef gone?
 http://forum.dlang.org/thread/aqsjjrtzfzslcopabqgs forum.dlang.org?page=2

 so If I want to define a new type as typedef string[] 
 surrealNumber, then it does not work?
it is replaced with alias. so for ur case this would looks like "alias string[] surrealNumber;" or "alias surrealNumber = string[];"
Nov 20 2013
parent "Dicebot" <public dicebot.lv> writes:
On Wednesday, 20 November 2013 at 10:54:31 UTC, evilrat wrote:
 On Wednesday, 20 November 2013 at 10:49:19 UTC, seany wrote:
 is typedef gone?
 http://forum.dlang.org/thread/aqsjjrtzfzslcopabqgs forum.dlang.org?page=2

 so If I want to define a new type as typedef string[] 
 surrealNumber, then it does not work?
it is replaced with alias. so for ur case this would looks like "alias string[] surrealNumber;" or "alias surrealNumber = string[];"
Those are not equivalent. Alias does not create new type.
Nov 20 2013
prev sibling next sibling parent "bearophile" <bearophileHUGS lycos.com> writes:
seany:

 is typedef gone?
 http://forum.dlang.org/thread/aqsjjrtzfzslcopabqgs forum.dlang.org?page=2
Right.
 so If I want to define a new type as typedef string[] 
 surrealNumber, then it does not work?
There is a Typedef implemented in Phobos. In some cases it works, but it's still buggy (search for it in Bugzilla if you want to know). Bye, bearophile
Nov 20 2013
prev sibling parent "Jesse Phillips" <Jesse.K.Phillips+D gmail.com> writes:
On Wednesday, 20 November 2013 at 10:49:19 UTC, seany wrote:
 is typedef gone?
 http://forum.dlang.org/thread/aqsjjrtzfzslcopabqgs forum.dlang.org?page=2

 so If I want to define a new type as typedef string[] 
 surrealNumber, then it does not work?
typedef was removed from the language, there were reasonable arguments for the type to act as a "base" or "child" type and could not satisfy both. alias operates as the C typedef does, it just gives another symbol to refer to the same thing, generally better for complex type names than need simplified.
Nov 20 2013