연산자 (프로그래밍): 두 판 사이의 차이

내용 삭제됨 내용 추가됨
17번째 줄:
 
== 피연산자 강제 변환 ==
{{참고|타입 변환형변환}}
Some몇몇 languages언어도 also암시적으로 allow변환할 for the있는 operands연산자의 of an operator to be implicitly converted피연산자, or혹은 [[Type_conversion형변환#Implicit_type_conversion암시적 형변환|''coerced강제'']], to발생하는 suitable연산을 data위한 types적합한 for자료형을 the operation to occur허용한다. For예를 example들어, in [[Perl]]에서 coercion강제적인 rules lead into규칙 <code>12 + "3.14"</code> producing the result of리드한 <code>15.14</code>.의 결과를 The산출한다. text문자열 <code>"3.14"</code> is덧셈이 converted대신 to the number숫자 3.14 before addition can take14로 place변환된다. Further추가로, <code>12</code> is an integer and정수이고 <code>3.14</code> is부동 either또는 a고정 floating소수점 or숫자 fixed-point number하나이다 (a그것에 number소수점 that자리를 has가진 a decimal place in it숫자) so the integer그래서 is정수는 then converted다음에 to각각 a부동 floating소수점 point또는 or고정 fixed-point소수점 number숫자로 respectively변환된다.
 
[[Javascript자바스크립트]] follows반대 opposite규칙을 rules—finding따른다—위와 the같은 same표현을 expression above찾는다면, it will convert the integer 문자열<code>"12"</code> into a string정수 <code>"12"</code>로 변환한다면, then concatenate the two operands to form <code>"123.14"</code> 형태에 두 피연산자를 연결한다.
 
언어에 의한 지배들의 존재에서, 프로그래머는 미묘한 프로그래밍 오류를 피하기 위해 피연산자 유형 및 작업 결과 유형에 대한 특정 규칙을 인식하고 있어야한다.
In the presence of coercions in a language, the programmer must be aware of the specific rules regarding operand types and the operation result type to avoid subtle programming mistakes.
 
== Operator features in programming languages ==