C++ error

Building and customizing Audacity from the source code.
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
Post Reply
Edgar
Forum Crew
Posts: 2043
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

C++ error

Post by Edgar » Mon Sep 29, 2014 9:41 am

In the file: srcprefsQualityPrefs.cpp at or near line numbers 167-179, examine this code:

Code: Select all

         S.TieChoice(_("Sample Rate Con&verter:"),
                     Resample::GetFastMethodKey(),
                     Resample::GetFastMethodDefault(),
                     mConverterNames,
                     mConverterLabels),
         S.SetSizeHints(mConverterNames);

         S.TieChoice(_("&Dither:"),
                     wxT("/Quality/DitherAlgorithm"),
                     Dither::none,
                     mDitherNames,
                     mDitherLabels);
         S.SetSizeHints(mDitherNames);
there are two pair of "TieChoice" examples. The first one has an error; note that the function, which ends on the line which reads:
mConverterLabels),
is followed by a comma as opposed to the appropriate semi-colon. The proper usage can be seen in the next one which ends on the line which reads:
mDitherLabels);
Obviously, it compiles, but I am not sure what the current or future ramifications might be.

Edgar
Forum Crew
Posts: 2043
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: C++ error

Post by Edgar » Mon Sep 29, 2014 9:43 am

It happens again at line number 193

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: C++ error

Post by steve » Wed Oct 01, 2014 12:47 am

I don't think it is actually an "Error" because a comma can be used there quite legally in C++ and the code does the same thing, but I agree that it is confusing, so I've fixed it (revision 13374).
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Edgar
Forum Crew
Posts: 2043
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: C++ error

Post by Edgar » Wed Oct 01, 2014 1:11 am

steve wrote:I don't think it is actually an "Error" because a comma can be used there quite legally in C++ and the code does the same thing, but I agree that it is confusing, so I've fixed it (revision 13374).
It actually is an error though almost all current compilers allow it, here is the exact definition from the C++ specification:
6.2 Expression statement
1 Expression statements have the form
expression-statement:
expression;
Note that the expression must be terminated with a semicolon and there is no leeway for any other form of punctuation. Thanks for making the change.

Post Reply