On Friday, 30 June 2023 at 20:12:08 UTC, Ali Çehreli wrote:
On 6/30/23 12:05, Cecil Ward wrote:
> I have code roughly like the following:
>
> dstring str = "name"d;
Aside: One almost never needs dstring.
> uint ordinal = (( str in Decls.ordinals ) !is null) ?
> Decls.ordinals[ str ] : -1;
>
> struct Decls
> {
> uint[ dstring] ordinals;
Do you mean 'ordinals' is 'static'? Otherwise, Decls.ordinals
does not compile.
> }
>
> //and
> Decls.ordinals[ str ] = ordinal_counter++;
Are you doing that *after* you initialize 'ordinal' as you show
here? :)
Ali
Hi Ali, ‘ordinal’ is a static initialised explicitly with zero.