Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update doctest to work with ARM DS5-compiler #64

Merged
merged 2 commits into from
Apr 20, 2017

Conversation

tomasnilefrost
Copy link
Contributor

While trying to use doctest with the ARM DS5-compiler I ran into some issues with the standard library methods (free, malloc, sprintf, printf etc) not being present.

ARM DS5 puts all of the standard library functions in the std-namespace and do not put anything in the global namespace.

See for instance the blog-post: https://developers.redhat.com/blog/2016/02/29/why-cstdlib-is-more-complicated-than-you-might-think/
"You must not assume that adds any names to the global namespace, and you must not assume that <xxx.h> adds any names to namespace std."

The solution is to explicitly point out for instance std::printf and not rely on the standard library for the specific compiler to export these symbols in the global namespace.

This might actually also be related to a previous pull-request ( #37 ) but I haven't investigated it further.

@onqtam
Copy link
Member

onqtam commented Apr 20, 2017

Thanks for the PR (made against the dev branch!!!)

The previous issue really seems related to this. I finally understand the difference between the headers - thanks for the redhat article.

I'm merging this as it is because it's the best option - even though a solution could be to just do using std::strcpy; and etc - or just include the headers in a C style - #include <xxx.h>. I'll also move away from most of these C functions as I move to streams and etc.

I will give a hard deadline for version 1.2 of 1 month from now (I keep postponing it...) - so only then will these changes appear in the master branch.

@onqtam onqtam merged commit 8d81aea into doctest:dev Apr 20, 2017
@tomasnilefrost
Copy link
Contributor Author

Thanks for accepting the pull request. Great job with doctest!

Regarding solution of using std::strcpy, it is probably best avoided since that would mean that all code including doctest.h would also get a polluted global namespace of these using-declarations.

onqtam pushed a commit that referenced this pull request May 15, 2017
* Prefix standard lib methods with std-namespace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants