لماذا لا تؤدي تعيين Double إلى int إلى تحذيرات دول مجلس التعاون الخليجي؟

StackOverflow https://stackoverflow.com/questions/1999172

  •  22-09-2019
  •  | 
  •  

سؤال

int i = 3.1 / 2

لا يتسبب في أي تحذيرات ، حتى مع خيار الحول. في بعض الأحيان ، أود أن أعرف أين تخسر Precision. لماذا لا تدعم GCC هذا التحذير ، في حين أن MSVC تدعم هذا التحذير؟

شكرًا.

تحرير: عروض GCC -V

Configured with: ../../gcc-4.4.1/configure --prefix=/mingw --build=mingw32 --enable-languages=c,ada,c++,fortran,objc,obj-c++ --disable-nls --disable-win32-registry --enable-libgomp --enable-cxx-flags='-fno-function-sections -fno-data-sections' --disable-werror --enable-threads --disable-symvers --enable-version-specific-runtime-libs --enable-fully-dynamic-string --with-pkgversion='TDM-2 mingw32' --enable-sjlj-exceptions --with-bugurl=http://www.tdragon.net/recentgcc/bugs.php

هل كانت مفيدة؟

المحلول

-النتورز يحذر من التحويل الضمني.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top