Closed andrewdavidsmith closed 9 years ago
I don't really understand the problem. Why would we want to define them twice? That also means anytime we want to change them we have to change them twice.
On Sun, May 4, 2014 at 11:01 AM, Andrew Smith notifications@github.comwrote:
I think the following appearing in headers works because versions of gcc supported them by extensions, not because it's standard C++. Current versions of gcc are warning against this:
// included in header in class definition static const double SEARCH_MAX_VAL = 100; static const double SEARCH_STEP_SIZE = 0.05;
The above should be declared in the class definition, but then defined outside, preferably in compiled code (the *.cpp).
— Reply to this email directly or view it on GitHubhttps://github.com/smithlabcode/preseq/issues/1 .
Timothy Daley University of Southern California
Andrew is right, that is an extension and is not standard C++. You wouldn't be defining them twice. You're declaring it in the header, and defining it (giving it a value) in the cpp file.
One is "declaration" and one is "definition."
Actually, what you are trying to do would end up failing on many compilers precisely because it would get defined multiple times...
In any case, with some compilers it will fail to compile, and in the future probably not even with GCC.
Andrew
On May 6, 2014, at 4:49 PM, Timothy Daley notifications@github.com wrote:
I don't really understand the problem. Why would we want to define them twice? That also means anytime we want to change them we have to change them twice.
On Sun, May 4, 2014 at 11:01 AM, Andrew Smith notifications@github.comwrote:
I think the following appearing in headers works because versions of gcc supported them by extensions, not because it's standard C++. Current versions of gcc are warning against this:
// included in header in class definition static const double SEARCH_MAX_VAL = 100; static const double SEARCH_STEP_SIZE = 0.05;
The above should be declared in the class definition, but then defined outside, preferably in compiled code (the *.cpp).
— Reply to this email directly or view it on GitHubhttps://github.com/smithlabcode/preseq/issues/1 .
Timothy Daley University of Southern California — Reply to this email directly or view it on GitHub.
I think the following appearing in headers works because versions of gcc supported them by extensions, not because it's standard C++. Current versions of gcc are warning against this:
// included in header in class definition static const double SEARCH_MAX_VAL = 100; static const double SEARCH_STEP_SIZE = 0.05;
The above should be declared in the class definition, but then defined outside, preferably in compiled code (the *.cpp).