www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - type suffix for character literal

reply Ben Jones <fake fake.fake> writes:
Are there suffices (suffixes?) for character literals?

Is there a more succinct of writing "the literal 'x' as a dchar" 
than dchar('x')?

I didn't see anything 
https://dlang.org/spec/lex.html#characterliteral but figured I'd 
ask the community
Dec 07 2020
parent Adam D. Ruppe <destructionator gmail.com> writes:
On Monday, 7 December 2020 at 22:26:52 UTC, Ben Jones wrote:
 Are there suffices (suffixes?) for character literals?
nope.
 Is there a more succinct of writing "the literal 'x' as a 
 dchar" than dchar('x')?
You should rarely need to since there's implicit casting. but I think that is the best way if you do need to.
Dec 07 2020