3 ms·
> I mean, it’s non-standard. What more do you need? so are most programming languages used in the world. In practice, #pragma once is less trouble than #ifdef
by jcelerier 8y ago
> I mean, it’s non-standard. What more do you need?
so are most programming languages used in the world. In practice, #pragma once is less trouble than #ifdef ; we had the debate just today in reddit :-) https://www.reddit.com/r/cpp/comments/a14o5q/real_world_problems_with_pragma_once/ https://www.reddit.com/r/cpp/comments/a14o5q/real_world_prob...
- groby_b 8y agoNobody is proposing a non-standard language, that's the point. Literally the entire reason for having a coding standard is to have a well-defined subset of the language you're using. Meanwhile, the "trouble" the reddit thread comes up with is copy/paste programming for #ifdef. That's a one-time effort of writing a commit hook that checks for that. But no amount of effort will ensure the next compiler you need supports #pragma once
- jcelerier 8y ago> Literally the entire reason for having a coding standard is to have a well-defined subset of the language you're using. that's a perversion of what "standards" means. Standards are originally there to codify existing practice, not to put new practice into existence. "#pragma once" is common enough that it has its own wikipedia page : https://en.wikipedia.org/wiki/Pragma_once https://en.wikipedia.org/wiki/Pragma_once with the list of all supported compilers.
- tdcbfdct3 8y ago"#pragma once" used to cause GCC to launch a game of Tetris instead of compiling your code. Not super relevant today, but a fun fact.
- saagarjha 8y agoIIRC, it cycled through NetHack, Rogue, and Tower of Hanoi.