DevO2012 / gflags

Automatically exported from code.google.com/p/gflags
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

gflags are not compile-time constants #58

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Define an integer-type flags, e.g. DEFINE_int64(bufferSize, 100, "buffer 
size");
2. Allocate a buffer using the flag as the buffer size, e.g. char 
buffer[FLAGS_bufferSize];

What is the expected output? What do you see instead?
This fails to compile on MSVC++ 2012, with the error:
error C2057: expected constant expression

What version of the product are you using? On what operating system?
gflags-2.0, Windows 7, statically built gflags lib using MSVC++ 2012.

Please provide any additional information below.
This also fails if I do the intermediate step below:
const int64_t BUF_SIZE = FLAGS_bufferSize;
char buffer[BUF_SIZE];

Original issue reported on code.google.com by Alex.Lou...@gmail.com on 3 Oct 2012 at 4:44

GoogleCodeExporter commented 9 years ago

Original comment by andreas....@gmail.com on 3 Oct 2012 at 5:06