C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Revising #pragma once

From: Jens Maurer <jens.maurer_at_[hidden]>
Date: Wed, 28 Aug 2024 12:33:53 +0200
On 28/08/2024 01.54, Arthur O'Dwyer via Std-Proposals wrote:
> (Of course it's possible that their answer is "/Nothing/ works in my environment, period; I will /never ever/ switch from #ifndef to #pragma once." In that case, the problem is solved, because we don't need to make GCC handle #pragma once in their environment — they'll never use it, so they'll never notice that it's missing.)

Not all code that wants to be compiled in a given environment
is necessarily home-grown. Maybe a third-party code provider
has decided to switch to "#pragma once" because it has been
standardized. However, now there is an expectation that it
works reliably everywhere, and we've seen good rationale it
doesn't.

We were in a situation where I could validly post a bug report
to the third-party library "your code is non-conforming; please
fix it". In the future, we are in a situation where I can't do
that anymore, and I need to post a bug report to my compiler
vendor "#pragma once is broken". And the answer probably
is "yes, sorry, the feature is unimplementable for certain
environmental conditions".

I much prefer the current situation over the future one,
also given that the disadvantages of not having "#pragma once"
are near-zero with current #ifdef short-cutting technology.

Jens

Received on 2024-08-28 10:33:56