Home  >  Article  >  Backend Development  >  Is Stateful Metaprogramming Doomed in C ?

Is Stateful Metaprogramming Doomed in C ?

Patricia Arquette
Patricia ArquetteOriginal
2024-11-16 02:12:02514browse

Is Stateful Metaprogramming Doomed in C  ?

Stateful Metaprogramming: Still Ill-Formed in C

Since its conception, stateful metaprogramming, also known as the "constexpr counter," has been a subject of fascination and debate. This technique allows developers to capture and retrieve metadata within template functions, enabling state storage in metaprogramming.

Concerns and the CWG

The C Working Group (CWG) has recognized concerns regarding stateful metaprogramming. Active Issue 2118 notes that such techniques are arcane and should be made ill-formed. In May 2015, the CWG agreed to prohibit these practices, although the exact mechanism for doing so remains undetermined.

Aftermath and Conclusion

Despite its legality in C 14, the status of stateful metaprogramming remains in limbo. Until a formal prohibition mechanism is established, it may persist as a valid technique. However, it's important to note that the CWG may retroactively rule it as a DR if a suitable mechanism is developed. Therefore, while stateful metaprogramming may currently be feasible, its future in C is uncertain.

The above is the detailed content of Is Stateful Metaprogramming Doomed in C ?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn