compiler-warnings

GCC conversion warning when assigning to a bitfield

落花浮王杯 提交于 2020-12-05 05:01:01
问题 Is there any way to supress the warning generated by gcc in this code: int main() { struct flagstruct { unsigned flag : 1; } a,b,c; a.flag = b.flag | c.flag; return a.flag; } The warning is warning: conversion to 'unsigned char:1' from 'int' may alter its value [-Wconversion] It looks like the the two flags are extended to int when ored together. What I think is really strange is that casting any of the two flags to unsigned supresses the warning. a.flag = (unsigned)b.flag | c.flag; Is this a

How to set '-Xuse-experimental=kotlin.experimental' in IntelliJ

﹥>﹥吖頭↗ 提交于 2020-12-04 15:58:48
问题 while trying to build a Kotlin/Ktor application in IntelliJ, multiple warnings of the form Warning:(276, 6) Kotlin: This class can only be used with the compiler argument '-Xuse-experimental=kotlin.Experimental' are output. The warnings refer to @UseExperimental(KtorExperimentalLocationsAPI::class) so I expected to satisfy the warning by setting Settings -> Build -> Compiler -> Kotlin Compiler -> Additional command line parameters to -version -Xuse-experimental=kotlin.Experimental . (

How to set '-Xuse-experimental=kotlin.experimental' in IntelliJ

半腔热情 提交于 2020-12-04 15:58:39
问题 while trying to build a Kotlin/Ktor application in IntelliJ, multiple warnings of the form Warning:(276, 6) Kotlin: This class can only be used with the compiler argument '-Xuse-experimental=kotlin.Experimental' are output. The warnings refer to @UseExperimental(KtorExperimentalLocationsAPI::class) so I expected to satisfy the warning by setting Settings -> Build -> Compiler -> Kotlin Compiler -> Additional command line parameters to -version -Xuse-experimental=kotlin.Experimental . (

How to set '-Xuse-experimental=kotlin.experimental' in IntelliJ

时光怂恿深爱的人放手 提交于 2020-12-04 15:58:07
问题 while trying to build a Kotlin/Ktor application in IntelliJ, multiple warnings of the form Warning:(276, 6) Kotlin: This class can only be used with the compiler argument '-Xuse-experimental=kotlin.Experimental' are output. The warnings refer to @UseExperimental(KtorExperimentalLocationsAPI::class) so I expected to satisfy the warning by setting Settings -> Build -> Compiler -> Kotlin Compiler -> Additional command line parameters to -version -Xuse-experimental=kotlin.Experimental . (

Why Compilation Does Not Fail?

倾然丶 夕夏残阳落幕 提交于 2020-11-30 02:01:24
问题 As expected, C/C++ compilation does fail with "warning: comparison between pointer and integer" for the program below: #include <stdbool.h> int main(void) { return (int*)42 == true; } But, the compilation does not fail when the true literal is changed to false . Why? Confirmed for: clang-1100.0.33.12, gcc 7.5.0 Unable to confirm for: g++ 7.5.0 回答1: In C, the macro false is defined as: #define false 0 So you're comparing a pointer against 0, which is a valid null pointer constant. 来源: https:/

Why Compilation Does Not Fail?

十年热恋 提交于 2020-11-30 02:00:06
问题 As expected, C/C++ compilation does fail with "warning: comparison between pointer and integer" for the program below: #include <stdbool.h> int main(void) { return (int*)42 == true; } But, the compilation does not fail when the true literal is changed to false . Why? Confirmed for: clang-1100.0.33.12, gcc 7.5.0 Unable to confirm for: g++ 7.5.0 回答1: In C, the macro false is defined as: #define false 0 So you're comparing a pointer against 0, which is a valid null pointer constant. 来源: https:/