for example, i want to write a function with this signature: int foo(char[]) and to call it using char[5] x; foo(x).
At the moment i get a compile error stating that char[] isn't the same as char[5].
I thought of writing: int foo(uint SIZE)(char[SIZE]) but then I have to explicitly set the length when calling foo: foo!5(x) for the example before.
EDIT: you guys are correct, my function actually looks like foo(ref char[]) and I have declared it @nogc. What I want to do is to fill a given static array with data.
In a broader sense, I'm trying to implement a degenerate format function because the standard library one is definitely using the GC and I can't call it from my other non GC code. Any ideas about that as well?
char[] is indeed not the same as char[5], but nothing prevents you from passing static array as an argument to a function which has char[] parameter because of the implicit conversion.
Example:
Output:
My guess is that you are getting error somewhere else...