Skip to content

Conversation

@marcelweikum
Copy link
Contributor

Hey,

this is my first PR, please check thoroughly if I missed something or did something wrong!

Thank you very much.

Kind regards,
Marcel

@github-actions
Copy link
Contributor

github-actions bot commented May 9, 2025

Hello. Thanks for opening a PR on Exercism 🙂

We ask that all changes to Exercism are discussed on our Community Forum before being opened on GitHub. To enforce this, we automatically close all PRs that are submitted. That doesn't mean your PR is rejected but that we want the initial discussion about it to happen on our forum where a wide range of key contributors across the Exercism ecosystem can weigh in.

You can use this link to copy this into a new topic on the forum. If we decide the PR is appropriate, we'll reopen it and continue with it, so please don't delete your local branch.

If you're interested in learning more about this auto-responder, please read this blog post.


Note: If this PR has been pre-approved, please link back to this PR on the forum thread and a maintainer or staff member will reopen it.

@@ -0,0 +1,14 @@
#ifndef ALPHAMETICS_H
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vaeng @siebenschlaefer What's our take on include guards? We have 64 exercises that use #if !defined(...), two use #ifndef ..., and 21 with #pragma once. Shouldn't we unify this? My vote would go to #pragma once for being the shortest and least error-prone. The only argument against it is the lack of standardization, but all relevant compilers implement it (and have done so for decades), so that's not a strong argument in my book. Wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm all for once. I would have to look it up, but I'm pretty sure I favored it in the header exercise as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://en.wikipedia.org/wiki/Pragma_once

Thus, #pragma once serves the same purpose as #include guards, but with several advantages, including less code, avoidance of name clashes, and sometimes improvement in compilation speed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a hard "No" vote but I prefer include guards over pragma once because the former ist standadized and the latter involves file system semantics.
See https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rs-guards
But if you folks like pragma one more and think all exercises should do the same then go for IT.

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.

4 participants