Re: Feature request, warnings for non safe calls within signal handlers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 15/03/2012 10:58, Jonathan Wakely wrote:
On 15 March 2012 09:36, David Brown wrote:
What you need here is a way of tagging the compilation state with some sort
of attributes, and a way of having functions and other parts of the code
check those attributes for particular features.  These features must be
definable in the user code, not just in the compiler, so they should
probably have string names and integer values.
[snip]

You might be interested in http://www.artima.com/cppsource/codefeatures.html

I believe the polynomial increases in compilation times and the need
for the global "AllCodeFeatures" container are solvable in C++11, e.g.
by using a variadic class template to represent compile-time strings,
which could be compared and sorted at compile-time to provide a total
order without needing all features to be known a priori.

Thanks for that link. I have seen the use of C++ templates before for this sort of idea (in particular, I have seen it for enforcing ordering of locks). Obviously it has the big advantage of being implemented within the existing tools. But the restriction to C, the ugly syntax (templates are useful, but not pretty), and the compile-time overhead make them a poor choice here.

Maybe the practical answer is to do this sort of checking independently of the compiler, somewhat akin to other static error checking.

>
> But that's straying off-topic for this list.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux