- 안영기의 개발실 -: 201905 기간의 글 목록
http://smgal.ismine.net/tc_191/blog1/
게임 개발을 기반으로 한, 잡다한 개발 기록 저장소
2020-01-21T02:49:39+09:00
Textcube 1.9.1
컴파일 때 trigraph 에 대한 경고문
안영기
http://smgal.ismine.net/tc_191/blog1/52
2019-05-15T00:26:05+09:00
2019-05-14T23:24:00+09:00
<div style="-en-clipboard: true;"><span style="font-size: small; font-family: arial, helvetica, sans-serif;">오랜만에 멀티플랫폼 빌드에서 특이한 경고를 보았다.</span></div>
<div> </div>
<pre><span style="font-family: 'courier new', courier; font-size: small;">sprintf(s, <span style="color: #008080;">"%s:?-??(??)"</span>, mi.pattern.c_str());</span></pre>
<div><span style="font-family: arial, helvetica, sans-serif; font-size: small;"><br />위의 코드가 문제의 코드인데, 다음과 같은 경고가 나왔다.</span></div>
<div> </div>
<pre><span style="font-family: 'courier new', courier; font-size: small;">warning: trigraph converted to '[' character [-Wtrigraphs]</span><br /><span style="font-family: 'courier new', courier; font-size: small;">sprintf(s, "%s:?-??(??)", mi.pattern.c_str());</span><br /><span style="font-family: 'courier new', courier; font-size: small;"> ^</span><br /><span style="font-family: 'courier new', courier; font-size: small;">warning: trigraph converted to ']' character [-Wtrigraphs]</span><br /><span style="font-family: 'courier new', courier; font-size: small;">sprintf(s, "%s:?-??(??)", mi.pattern.c_str());</span><br /><span style="font-family: 'courier new', courier; font-size: small;"> ^</span></pre>
<div> </div>
<div><span style="font-family: arial, helvetica, sans-serif; font-size: small;">최근에는 거의 생각치도 않던 spec인 trigraph가 여기에 적용된 것인데,</span></div>
<div><span style="font-family: arial, helvetica, sans-serif; font-size: small;">예상을 못했던 것은 따옴표 안의 문장에서도 trigraph가 적용된다는 것이었다.</span></div>
<div> </div>
<div><span style="font-family: arial, helvetica, sans-serif;">??( 는 [ 로, ??) 는 ] 로 변환이 되니, 문제의 </span></div>
<div><span style="font-family: 'courier new', courier; font-size: small;">"%s:?-??(??)"</span> 는</div>
<div><span style="font-family: 'courier new', courier; font-size: small;">"%s:?-[]"</span> 가 된다.</div><p><strong><a href="http://smgal.ismine.net/tc_191/blog1/52?commentInput=true#entry52WriteComment">댓글 쓰기</a></strong></p>