cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Translate the entire conversation x

Object Toolkit - C++ standard and its violations.

Piotr
8-Gravel

Object Toolkit - C++ standard and its violations.

Hello Guys. We are struggling a bit with some "not very good" practices that are implemented  by PTC in C++ Object Toolkit API.

 

First is bad&ugly define which collides with default type from standard library. So inside of  ciptype.h at line 68 we have 

 

# define optional

 

which obviously is in conflict with std::optional (see cppreference)

 

Second a bit strange approach we may find in: cipxobj.h and xstring.h both at line 17

 

using namespace std;
 

According to not only CPP reference but to well known best practices it's bad idea:

 

(see cppreference)

The using-directive using namespace std; at any namespace scope introduces every name from the namespace std into the global namespace (since the global namespace is the nearest namespace that contains both std and any user-declared namespace), which may lead to undesirable name collisions. This, and other using directives are generally considered bad practice at file scope of a header file (SF.7: Don’t write using namespace at global scope in a header file).

 

We use Creo Parametric 10.0.5.0  but issue exits there for many years and when C++ 17  standard appeared this become more painful. 

 

Please PTC, remove those lines from your API and make it more modern (and user friendly) 

 

 

 

4 REPLIES 4
Catalina
Moderator
(To:Piotr)

Hi @Piotr 

 

Thank you for using the Community!

 

I'd like to suggest posting a product improvement idea here: https://community.ptc.com/t5/Creo-Parametric-Ideas/idb-p/creoparametric

 

Please let me know if you have any questions!

 

Best regards,


Catalina
PTC Community Moderator
PTC
Piotr
8-Gravel
(To:Catalina)

Catalina! Thanks for your hint. Unfortunately your link doesn't work  for me. Can you check if it's ok ? 

Catalina
Moderator
(To:Piotr)

Hi Piotr,

 

Sorry about that! One . at the end was the culprit. Should work well now. 😄 


Catalina
PTC Community Moderator
PTC
FV
17-Peridot
17-Peridot
(To:Piotr)

good point. my advise is to use pro/toolkit and do not touch otk unless absolutely necessary... 

C++ with pro/toolkit builds clean with C++17 and C++20 even with PTC provided make_install make files with almost no modifications beside changing a switch from c to cpp and specifying c++ target standard. 

Announcements


Top Tags