Created
July 19, 2012 01:52
-
-
Save tri-man/3140259 to your computer and use it in GitHub Desktop.
D版のコード
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module main; | |
import std.stdio; | |
struct VECTOR | |
{ | |
float x, y, z; | |
} | |
VECTOR VSet( float x, float y, float z ) | |
{ | |
VECTOR rtn; | |
rtn.x = x; | |
rtn.y = y; | |
rtn.z = z; | |
return rtn; | |
} | |
VECTOR VAdd( const ref VECTOR in_val ) | |
//VECTOR VAdd( VECTOR in_val ) | |
{ | |
VECTOR rtn; | |
rtn.x = in_val.x + 1.0f; | |
return rtn; | |
} | |
int main(string[] argv) | |
{ | |
VECTOR vec = VAdd( VSet( 0.0f, 1.0f, 0.0f) ); | |
printf( "vec(%f,%f,%f)", vec.x, vec.y, vec.z ); | |
return 0; | |
} | |
/** | |
エラーメッセージは | |
main.d(27): Error: function main.VAdd (ref const(VECTOR) in_val) is not callable using argument types (VECTOR) | |
main.d(27): Error: VSet(0F,1F,0F) is not an lvalue | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment