Re: C style array declaration.

2018-03-26 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 26 March 2018 at 10:16:55 UTC, Aedt wrote: I'm a big fan of betterC. In C, you can initialize an array without specifying the length like this int ia[ ] = {0, 2, 1}; That's the equivalent of D's static arrays if a variable, and is passed to C functions as a pointer. So important t

Re: C style array declaration.

2018-03-26 Thread ag0aep6g via Digitalmars-d-learn
On 03/26/2018 12:16 PM, Aedt wrote: I'm a big fan of betterC. In C, you can initialize an array without specifying the length like this int ia[ ] = {0, 2, 1}; What is the translation of this? The language doesn't have that feature. But there's a PR to add `staticArray` to the standard librar

Re: C style array declaration.

2018-03-26 Thread rikki cattermole via Digitalmars-d-learn
On 26/03/2018 11:16 PM, Aedt wrote: I'm a big fan of betterC. In C, you can initialize an array without specifying the length like this int ia[ ] = {0, 2, 1}; What is the translation of this? Note that int[] is a different type than C's arrays. https://dlang.org/spec/interfaceToC.html#data_ty

C style array declaration.

2018-03-26 Thread Aedt via Digitalmars-d-learn
I'm a big fan of betterC. In C, you can initialize an array without specifying the length like this int ia[ ] = {0, 2, 1}; What is the translation of this? Note that int[] is a different type than C's arrays. https://dlang.org/spec/interfaceToC.html#data_type_compat says there are no equivale