<div dir="ltr">Hi,<div><br></div><div>I hope I found the right place for this question. I was trying something very basic, i.e. to read a double followed by a character, from cin, and noticed that there is a difference between the way this works using g++ 4.2.8 on linux and the way it does (not work) using libc++ on a mac with the latest version of xcode.</div><div><br></div><div>The entire code has only a few lines:</div><div><br></div><div>------------------------------------------------</div><div>#include<iostream></div><div><div>using namespace std;</div><div><br></div><div>int main() {<br></div><div> char c;</div><div> float d;</div><div> while(cin >> d >> c) cout << d << c << endl;<br></div><div>}<br></div></div><div><div>------------------------------------------------</div></div><div><br></div><div>When I compile this on linux using g++ 4.2.8, typing "2a", for example, produces "2a", and so on, as required. </div><div><br></div><div>However, compiling this on the mac with Apple LLVM version 7.0.0 (clang-700.0.72), using </div><div>"clang++ -stdlib=libc++ --std=c++11 test.cpp", "2a", "2b", and quite a few more, fail.</div><div><br></div><div>It seems strange to me that such a basic operation can produce different results. Do you have any thoughts? </div><div><br></div><div>Kind regards,</div><div>Marco</div>
<div><br></div></div>