A type conversion where the destination type which cannot represent all values in the source type.
Questions tagged [narrowing]
167 questions
-1
votes
1 answer
C++ / OpenGL: Texture to pixmap example - narrowing conversion error
I am trying to run this texture to pixmap example from OpenGL and get the following error
tex_to_pix.cpp:40:1: error: narrowing conversion of ‘4294967295u’ from ‘unsigned int’ to ‘int’ inside { } [-Wnarrowing]
The error refers to the following code…

ephtron
- 1,115
- 1
- 10
- 16
-1
votes
1 answer
How to define an integer vector containing scientific notation correctly in C++?
The code
#include
#include
int main () { std::vector N = {3e6, 4e6}; }
Gives an error
error: narrowing conversion of ‘3.0e+6’ from ‘double’ to ‘int’ inside { } [-Wnarrowing]|||.
Whereas
#include
#include…

Gytis
- 111
- 2