óÀ½, ÀÌÀü, ´ÙÀ½, ¸¶Áö¸· Àý·Î °¡±â, ¸ñÂ÷.
¿ø¹®½ÃÀÛ
Value and location conversions are highly dependent on the target machine.
They are also very loosely specified in the 1988 standard.
(The 1992 standard seems an improvement.)
The GNU Chill compiler interprets mode(exp)
as follows:
-
If exp is a referable location,
and the size of (the mode of) exp is the same as the size of mode,
a location conversion is used.
It is implemented exactly as:
(refmode(-> exp))->
,
where refmode is a synmode for REF mode
.
The programmer is responsible for making sure that alignment
restrictions on machine addresses are not violated.
If both mode and the mode of exp are discrete modes,
alignment should not be a problem, and we get the same conversion
as a standard value conversion.
-
If exp is a constant,
and the size of (the mode of) exp is the same as the size of mode,
then a value conversion is performed. This conversion is done
at compile time, and it has not been implemented for all types.
Specifically, converting to or from a floating-point type is not implemented.
-
If both mode and the mode of exp are discrete modes,
then a value conversion is performed, as described in Z.200.
-
If both mode and the mode of exp are reference modes,
then a value conversion is allowed.
The same is true is one mode is a reference mode, and the other
is an integral mode of the same size.
¿ø¹®³¡
°ª°ú À§Ä¡ º¯È¯Àº ¸ñÇ¥ ±â°è(target machine)¿¡ Å©°Ô ÀÇÁ¸ÇÑ´Ù. ±×°ÍµéÀº ¶ÇÇÑ 1988³â Ç¥ÁØ¿¡ ¾ÆÁÖ ¸·¿¬ÇÏ°Ô Á¤ÇØÁ® ÀÖ´Ù.(1992 Ç¥ÁØÀº °³¼±µÈ °Í °°´Ù.)
GNU Chill ÄÄÆÄÀÏ·¯´Â ´ÙÀ½°ú °°ÀÌ mode(exp)
¸¦ Çؼ®ÇÑ´Ù:
-
¸¸¾à exp°¡ ÂüÁ¶°¡´ÉÇÑ À§Ä¡°í expÀÇ Å©±â(¸ðµå)°¡ modeÀÇ Å©±â¿Í °°´Ù¸é, À§Ä¡ º¯È¯ÀÌ »ç¿ëµÈ´Ù. ±×°ÍÀº
(refmode(-> exp))->
°ú °°ÀÌ Á¤È®È÷ ½ÇÇàµÈ´Ù. ¿©±â¼ refmode´Â REF mode
¿¡ ´ëÇÑ ÇÕ¼º¸ðµå(synmode)ÀÌ´Ù. ÇÁ·Î±×·¡¸Ó´Â ±â°è ¹øÁö»óÀÇ Á¤·Ä Á¦ÇÑÀÌ ¾î°ÜÁöÁö ¾Ê´Â´Ù´Â °ÍÀ» È®ÀÎÇÒ Ã¥ÀÓÀÌ ÀÖ´Ù. ¸¸¾à mode¿Í expÀÇ ¸ðµå°¡ µÑ´Ù ÀÌ»ê ¸ðµå(discrete mode)¶ó¸é ¹®Á¦µÉ °ÍÀÌ ¾ø´Ù. ±×¸®°í Ç¥ÁØ ¼öÄ¡ º¯È¯°ú µ¿ÀÏÇÑ º¯È¯À» ¾ò´Â´Ù.
-
¸¸¾à exp°¡ »ó¼öÀÌ°í exp ÀÇ Å©±â(¸ðµå)°¡ modeÀÇ Å©±â¿Í °°´Ù¸é, ¼öÄ¡ º¯È¯ÀÌ ¼öÇàµÈ´Ù. ÀÌ º¯È¯Àº ÄÄÆÄÀÏ ½Ã°£¿¡ ÇàÇØÁø´Ù. ¸ðµç ŸÀÔ¿¡ ´ëÇØ ½ÇÇàµÇÁö´Â ¾Ê´Â´Ù. ƯÈ÷ ºÎµ¿ ¼Ò¼öÁ¡(floating-point) ŸÀÔÀ» º¯È¯Çϰųª ºÎµ¿¼Ò¼öÁ¡ ŸÀÔÀ¸·Î º¯ÈÇÏ´Â °ÍÀº ½ÇÇàµÇÁö ¾Ê´Â´Ù.
-
¸¸¾à mode ¿Í expÀÇ ¸ðµå°¡ µÑ´Ù ÀÌ»ê ¸ðµå¶ó¸é, Z.200¿¡ ±â¼úµÈ °Í°ú °°ÀÌ ¼öÄ¡ º¯È¯ÀÌ ¼öÇàµÈ´Ù.
-
¸¸¾à mode ¿Í expÀÇ ¸ðµå°¡ µÑ´Ù ÂüÁ¶ ¸ðµå(reference mode)¶ó¸é ¼öÄ¡ º¯È¯ÀÌ Çã¿ëµÈ´Ù. ±×¿Í °°Àº °ÍÀÌ ¿Ç´Ù¶ó´Â °ÍÀº ÇÑ ¸ðµå°¡ ÂüÁ¶ ¸ðµåÀÌ°í, ´Ù¸¥ Çϳª°¡ °°Àº Å©±âÀÇ integral ¸ðµå¶ó´Â °ÍÀÌ´Ù.
óÀ½, ÀÌÀü, ´ÙÀ½, ¸¶Áö¸· Àý·Î °¡±â, ¸ñÂ÷.