mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-02-25 08:03:13 +01:00
[svn r95] added support for mains like:
T main(string[] args) fixed a bug with slicing a pointer that is an argument with no storage
This commit is contained in:
17
test/bug54.d
Normal file
17
test/bug54.d
Normal file
@@ -0,0 +1,17 @@
|
||||
module bug54;
|
||||
|
||||
extern(C) size_t strlen(char*);
|
||||
|
||||
// creating args for main
|
||||
void d_main_args(size_t n, char** args, ref char[][] res)
|
||||
{
|
||||
assert(res.length == n);
|
||||
foreach(i,v; args[0..n])
|
||||
{
|
||||
res[i] = v[0 .. strlen(v)];
|
||||
}
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
}
|
||||
9
test/mainargs1.d
Normal file
9
test/mainargs1.d
Normal file
@@ -0,0 +1,9 @@
|
||||
module mainargs1;
|
||||
|
||||
void main(string[] args)
|
||||
{
|
||||
foreach(v; args)
|
||||
{
|
||||
printf("%.*s\n", v.length, v.ptr);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user