View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0008239 | Open CASCADE | OCCT:Foundation Classes | public | 2005-02-22 10:17 | 2019-08-17 12:32 |
Reporter | stv | Assigned To | bugmaster | ||
Priority | normal | Severity | trivial | ||
Status | closed | Resolution | fixed | ||
OS | Windows NT | ||||
Target Version | 7.4.0 | Fixed in Version | 7.4.0 | ||
Summary | 0008239: Foundation Classes - directive "using namespace std" doesn't allow to build application with OCC and other 3rd party libraries | ||||
Description | If custom application uses the OCC and other 3rd party library (for example VTK or Qt) based on ANSI streams then compiler fails during determination stream symbols: istream, ostream, ... (compiler error C2872). Directive "using namespace std" export the all symbol from std namespace into global scope. Possible solution is not to use directive "using namespace std", but explicitly specify STL stream symbols (std::ostream) and define preprocessor directive as namespace prefix name for it. Enclosed archive (OCC_Streams.tgz) contains example which illustrate proposed solution with preprocessor directive OCC_STREAM_STD. Do not hestitate to contact me. Regards, STV | ||||
Steps To Reproduce | Not required | ||||
Tags | No tags attached. | ||||
Test case number | Not required | ||||
2005-02-22 08:17
|
OCC_Streams.tgz (10,240 bytes) |
2005-02-22 12:23
|
Sun_Forte_log.tgz (6,415 bytes) |
|
Currently we have a set of uses statements for a set of symbols from std namespace (mostly streams) in Standard_Stream.hxx. This can still cause incompatibilities, thus it might be reasonable to remove these, adding prefix std:: explicitly to all references to these symbols in OCCT code. |
|
Branch CR8239 has been created by tizmaylo. SHA-1: 9866caf30c80ffb80bcac7cbe0d6a3c487460ea3 Detailed log of new commits: Author: tiv Date: Fri Jul 26 09:42:14 2019 +0300 |
|
Branch CR8239_1 has been created by tizmaylo. SHA-1: 3fbb700f53cf4593254a2de3f72bf14a3700ec36 Detailed log of new commits: Author: tiv Date: Fri Jul 26 10:30:33 2019 +0300 0008239: Foundation Classes - directive "using namespace std" doesn't allow to build application with OCC and other 3rd party libraries "using namespace" directives are removed from some places. Last entries of "using std::" are also removed. |
|
Branch CR8239 has been updated by tizmaylo. SHA-1: 7542fcc6b4eb399c2bd3487d0929ea185d903eb9 Detailed log of new commits: Author: tiv Date: Fri Jul 26 15:35:06 2019 +0300 |
|
Branch CR8239_1 has been updated forcibly by tizmaylo. SHA-1: 5cab22b700882c55c07bbfdb899f066d0ee6edd0 |
|
Branch CR8239 has been updated by tizmaylo. SHA-1: 93c0f52728f5ab80fe048994aaa7a11a5c82e4c7 Detailed log of new commits: Author: tiv Date: Fri Jul 26 16:29:19 2019 +0300 |
|
Branch CR8239_1 has been updated forcibly by tizmaylo. SHA-1: 70905c20fdbc6197a1b0684156b450bf524cb2ea |
|
Branch CR8239 has been updated forcibly by tizmaylo. SHA-1: 7d74cdfcf2184054163b4c331e9ce4135122c1e6 |
|
Branch CR8239_1 has been updated forcibly by tizmaylo. SHA-1: 8204c225d5b6d3566bbb74d98679bb97ddad63bf |
|
Branch CR8239 has been updated by tizmaylo. SHA-1: 1875e1ba1433a699a16e25cb50e60ccd182bf55d Detailed log of new commits: Author: tiv Date: Fri Jul 26 17:34:43 2019 +0300 |
|
Branch CR8239_1 has been updated forcibly by tizmaylo. SHA-1: e1503097c777d88c47222e2b89cc298ae72acd9b |
|
Branch CR8239 has been updated by tizmaylo. SHA-1: 9dab76078003ed65a1a87a6253d9fd921901ca2d Detailed log of new commits: Author: tiv Date: Fri Jul 26 18:42:27 2019 +0300 # std:: prefixes are added in the right places in samples. |
|
Branch CR8239_1 has been updated forcibly by tizmaylo. SHA-1: abb154e25cf8f77735df436c343d8468836f1f35 |
|
Branch CR8239 has been updated forcibly by tizmaylo. SHA-1: 2b1ad608a172e016760a56cc700e91bae52979a3 |
|
Branch CR8239_1 has been updated forcibly by tizmaylo. SHA-1: 95a1d0597087e7346c3511d4b20b3d4112914e47 |
|
Branch CR8239_1 has been deleted by inv. SHA-1: 95a1d0597087e7346c3511d4b20b3d4112914e47 |
|
Branch CR8239_1 has been created by tizmaylo. SHA-1: 66a879e19331a4fcde9d68df0e6a9d744c2075cd Detailed log of new commits: Author: tiv Date: Mon Jul 29 11:58:08 2019 +0300 0008239: Foundation Classes - directive "using namespace std" doesn't allow to build application with OCC and other 3rd party libraries "using namespace" directives are removed from some places. Last entries of "using std::" are also removed. "endl" manipulator for Message_Messenger is renamed to "Message_EndLine". |
|
Branch CR8239 has been updated forcibly by tizmaylo. SHA-1: 5b4b047b7110f4f164c2709af69251d29ad31315 |
|
Branch CR8239_1 has been updated forcibly by tizmaylo. SHA-1: d5dcd46f9a92d43059b1aa70e64b0788997c9da8 |
2019-08-02 13:51 developer |
CompilationErrorFixer.cxx (16,590 bytes) |
2019-08-02 13:52 developer |
compilation_error_replacement_rules.txt (442 bytes) |
|
Patch is ready for review: http://jenkins-test-12.nnov.opencascade.com:8080/view/CR8239-master-TIV/view/ALL/ Main OCCT branch: CR8239 OCCT branch with squashed commits: CR8239_1 Main branch in OCCT Products: CR8239 OCCT Products branch with squashed commits: CR8239_1 Some comments on this patch: Most of the changes are related to the removing of the last entries of using std:: from the header file Standard_Stream.hxx. There were the following names of the standard library objects:
The corresponding changes in other source files consist of adding std:: prefixes to these names. These changes were done mostly via the following and some other regular expressions:
Some of changes were done via the specially created compilation error fixer (its source code written in C++17 is attached, look at the file CompilationErrorFixer.cxx, https://tracker.dev.opencascade.org/file_download.php?file_id=13678&type=bug). This program parses a build output of Microsoft Visual C++ compiler and tries to fix found compilation errors following the user-defined replacement rules. An example of the file containing such rules is attached (compilation_error_replacement_rules.txt, https://tracker.dev.opencascade.org/file_download.php?file_id=13679&type=bug). An example of a command line to start compilation error fixer application: CompilationErrorFixer.exe compilation_error_replacement_rules.txt build_output.txt The compilation error fixer was mostly used to rename the manipulator endl (defined in Message_Messenger.hxx) used with Message_Messenger class (there were about 2,000 places in the source files where this manipulator was used). The total number of the files that were changed in OCCT: 961. |
|
Branch CR08239_2 has been created by kgv. SHA-1: 0631b8c48286d62066db409c2027d265de86d0fe Detailed log of new commits: Author: kgv Date: Tue Aug 13 11:33:20 2019 +0300 0008239: Foundation Classes - directive "using namespace std" doesn't allow to build application with OCC and other 3rd party libraries Standard_Stream.hxx no more adds "using std::" entities. |
|
Please raise the patch (CR08239_2 in OCCT and CR30895 from Products from another issue). http://jenkins-test-12.nnov.opencascade.com:8080/view/CR08239_2-CR30895-KGV/ |
|
Combination - OCCT branch : CR08239_2 master SHA - 0631b8c48286d62066db409c2027d265de86d0fe 5f5b1aed1c6e139bbd34314eca77ae7abcd8895c Products branch : CR30895 SHA - 6c5e84c652ce1299c2e1c3b2eff1a35443a236a9 was compiled on Linux, MacOS and Windows platforms and tested in optimize mode. Number of compiler warnings: No new/fixed warnings Regressions/Differences/Improvements: No regressions/differences CPU differences: Debian80-64: OCCT Total CPU difference: 16243.920000000046 / 16274.830000000024 [-0.19%] Products Total CPU difference: 10479.200000000044 / 10475.390000000047 [+0.04%] Windows-64-VC14: OCCT Total CPU difference: 17671.03125 / 17627.84375 [+0.24%] Products Total CPU difference: 12057.671875 / 11990.921875 [+0.56%] Image differences : No differences that require special attention Memory differences : No differences that require special attention |
|
Branch CR08239_2 has been deleted by inv. SHA-1: 0631b8c48286d62066db409c2027d265de86d0fe |
|
Branch CR8239_1 has been deleted by inv. SHA-1: d5dcd46f9a92d43059b1aa70e64b0788997c9da8 |
|
Branch CR8239 has been deleted by inv. SHA-1: 5b4b047b7110f4f164c2709af69251d29ad31315 |
occt: master 7fab82af 2019-08-13 08:33:20 Committer: bugmaster Details Diff |
0008239: Foundation Classes - directive "using namespace std" doesn't allow to build application with OCC and other 3rd party libraries Standard_Stream.hxx no more adds "using std::" entities. |
Affected Issues 0008239 |
|
mod - dox/dev_guides/upgrade/upgrade.md | Diff File | ||
mod - src/Message/Message_Messenger.hxx | Diff File | ||
mod - src/Standard/Standard_Stream.hxx | Diff File |
Date Modified | Username | Field | Change |
---|---|---|---|
2005-02-22 10:19 | bugmaster | Assigned To | bugmaster => imv |
2005-02-22 10:19 | bugmaster | Status | new => assigned |
2005-02-22 14:24 | bugmaster | Assigned To | imv => stv |
2007-07-06 18:22 |
|
Assigned To | stv => abv |
2011-08-02 11:23 | bugmaster | Category | OCCT:FDC => OCCT:Foundation Classes |
2012-01-19 14:38 |
|
Fixed in Version | EMPTY => |
2012-01-19 14:38 |
|
Description Updated | |
2014-04-04 06:50 |
|
Note Added: 0028666 | |
2014-09-12 14:29 |
|
Target Version | => 7.1.0 |
2016-11-01 06:21 |
|
Target Version | 7.1.0 => 7.2.0 |
2017-08-15 12:49 |
|
Target Version | 7.2.0 => Unscheduled |
2019-07-18 18:55 | kgv | Assigned To | abv => tizmaylo |
2019-07-18 18:55 | kgv | Target Version | Unscheduled => 7.5.0 |
2019-07-18 18:56 | kgv | Relationship added | related to 0005531 |
2019-07-21 12:23 |
|
Summary | Directive "using namespace std" doesn't allow to build application with OCC and other 3rd party libraries => Foundation Classes - directive "using namespace std" doesn't allow to build application with OCC and other 3rd party libraries |
2019-07-26 10:33 | git | Note Added: 0085885 | |
2019-07-26 10:33 | git | Note Added: 0085886 | |
2019-07-26 15:46 | git | Note Added: 0085897 | |
2019-07-26 15:46 | git | Note Added: 0085898 | |
2019-07-26 16:35 | git | Note Added: 0085900 | |
2019-07-26 16:36 | git | Note Added: 0085901 | |
2019-07-26 17:06 | git | Note Added: 0085903 | |
2019-07-26 17:06 | git | Note Added: 0085904 | |
2019-07-26 17:39 | git | Note Added: 0085907 | |
2019-07-26 17:39 | git | Note Added: 0085908 | |
2019-07-26 21:51 | git | Note Added: 0085911 | |
2019-07-26 21:51 | git | Note Added: 0085912 | |
2019-07-29 09:28 | git | Note Added: 0085923 | |
2019-07-29 09:28 | git | Note Added: 0085924 | |
2019-07-29 09:59 | git | Note Added: 0085925 | |
2019-07-29 12:00 | git | Note Added: 0085935 | |
2019-08-02 10:35 | git | Note Added: 0085981 | |
2019-08-02 10:36 | git | Note Added: 0085982 | |
2019-08-02 13:51 |
|
File Added: CompilationErrorFixer.cxx | |
2019-08-02 13:52 |
|
File Added: compilation_error_replacement_rules.txt | |
2019-08-02 16:20 |
|
Note Added: 0086000 | |
2019-08-02 16:27 |
|
Note Edited: 0086000 | |
2019-08-02 16:30 |
|
Note Edited: 0086000 | |
2019-08-02 16:33 |
|
Note Edited: 0086000 | |
2019-08-02 16:34 |
|
Note Edited: 0086000 | |
2019-08-02 16:35 |
|
Note Edited: 0086000 | |
2019-08-02 16:38 |
|
Note Edited: 0086000 | |
2019-08-02 16:39 |
|
Note Edited: 0086000 | |
2019-08-02 16:41 |
|
Note Edited: 0086000 | |
2019-08-02 16:41 |
|
Assigned To | tizmaylo => kgv |
2019-08-02 16:41 |
|
Status | assigned => resolved |
2019-08-02 16:41 |
|
Steps to Reproduce Updated | |
2019-08-13 10:57 | kgv | Relationship added | related to 0030895 |
2019-08-13 11:35 | git | Note Added: 0086220 | |
2019-08-13 13:51 | kgv | Note Added: 0086224 | |
2019-08-13 13:51 | kgv | Assigned To | kgv => bugmaster |
2019-08-13 13:51 | kgv | Status | resolved => reviewed |
2019-08-13 13:51 | kgv | Target Version | 7.5.0 => 7.4.0 |
2019-08-13 19:55 | bugmaster | Note Added: 0086235 | |
2019-08-13 19:55 | bugmaster | Status | reviewed => tested |
2019-08-13 19:59 | bugmaster | Test case number | => Not required |
2019-08-17 12:07 | bugmaster | Changeset attached | => occt master 7fab82af |
2019-08-17 12:07 | bugmaster | Status | tested => verified |
2019-08-17 12:07 | bugmaster | Resolution | open => fixed |
2019-08-17 12:24 | git | Note Added: 0086300 | |
2019-08-17 12:24 | git | Note Added: 0086305 | |
2019-08-17 12:24 | git | Note Added: 0086306 |