annotate run/default_argument_04.d @ 1630:d0efa3ae5522 default tip

run/mini/naked_asm5: New x86_64 ABI passes the arguments in reverse order.
author David Nadlinger <code@klickverbot.at>
date Sat, 23 Apr 2011 22:57:32 +0200
parents f87ba6507260
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
374
f87ba6507260 added missing meta-data
thomask
parents: 61
diff changeset
1 // $HeadURL$
f87ba6507260 added missing meta-data
thomask
parents: 61
diff changeset
2 // $Date$
f87ba6507260 added missing meta-data
thomask
parents: 61
diff changeset
3 // $Author$
f87ba6507260 added missing meta-data
thomask
parents: 61
diff changeset
4
61
b2fad05c7d55 extended default argument tests
thomask
parents:
diff changeset
5 module dstress.run.default_argument_04;
b2fad05c7d55 extended default argument tests
thomask
parents:
diff changeset
6
b2fad05c7d55 extended default argument tests
thomask
parents:
diff changeset
7 int test(char[] a="abc"){
b2fad05c7d55 extended default argument tests
thomask
parents:
diff changeset
8 if(a is null){
b2fad05c7d55 extended default argument tests
thomask
parents:
diff changeset
9 return -1;
b2fad05c7d55 extended default argument tests
thomask
parents:
diff changeset
10 }else{
b2fad05c7d55 extended default argument tests
thomask
parents:
diff changeset
11 return a.length;
b2fad05c7d55 extended default argument tests
thomask
parents:
diff changeset
12 }
b2fad05c7d55 extended default argument tests
thomask
parents:
diff changeset
13 }
b2fad05c7d55 extended default argument tests
thomask
parents:
diff changeset
14
b2fad05c7d55 extended default argument tests
thomask
parents:
diff changeset
15 int main(){
b2fad05c7d55 extended default argument tests
thomask
parents:
diff changeset
16 assert(test()==3);
b2fad05c7d55 extended default argument tests
thomask
parents:
diff changeset
17 assert(test("")==0);
b2fad05c7d55 extended default argument tests
thomask
parents:
diff changeset
18 assert(test(null)==-1);
b2fad05c7d55 extended default argument tests
thomask
parents:
diff changeset
19 assert(test("ab")==2);
b2fad05c7d55 extended default argument tests
thomask
parents:
diff changeset
20 return 0;
b2fad05c7d55 extended default argument tests
thomask
parents:
diff changeset
21 }