Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
November 20, 2013 typedef '? | ||||
---|---|---|---|---|
| ||||
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? |
November 20, 2013 Re: typedef '? | ||||
---|---|---|---|---|
| ||||
Posted in reply to seany | 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[];"
|
November 20, 2013 Re: typedef '? | ||||
---|---|---|---|---|
| ||||
Posted in reply to seany | 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 |
November 20, 2013 Re: typedef '? | ||||
---|---|---|---|---|
| ||||
Posted in reply to evilrat | 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.
|
November 20, 2013 Re: typedef '? | ||||
---|---|---|---|---|
| ||||
Posted in reply to seany | 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.
|
Copyright © 1999-2021 by the D Language Foundation