C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Keeping C++ Young: Migrating to Modern C++

From: Sebastian Wittmeier <wittmeier_at_[hidden]>
Date: Mon, 6 Nov 2023 13:09:24 +0100
Hi Yexuan,   to go back from discussions about the merits of specific old features of C++ to your proposal about a language feature:     The effect would be similar to deprecated - giving a warning, when a symbol is used   As a difference, one can turn the feature on and off with the directive #strict    - Why not use a command-line switch to turn on/off deprecated warnings? Or use pragmas to turn on/off the warnings, if it should be done in source code.  - What advantage does the proposal have, compared to deprecated? Aside from, whether the reason to discourage using symbols is, that they may be removed or will possibly stay, but should be avoided nevertheless? The reason to discourage symbols can be stated inside the deprecated string.     Or do you mainly propose that some symbols in the standard library should be discouraged by default?   Deprecation already can be done on a project basis:   "A name declared non-deprecated may be redeclared deprecated."   Do you still want to introduce a level below deprecation and only sometimes enforced by the standard (if strict is used)?   Perhaps that could be included into a broader proposal about C++ profiles, e.g. safety profiles, strict profiles, ...     Best, Sebastian   -----Ursprüngliche Nachricht----- Von:Yexuan Xiao via Std-Proposals <std-proposals_at_[hidden]> Gesendet:So 05.11.2023 12:12 Betreff:[std-proposals] Keeping C++ Young: Migrating to Modern C++ An:std-proposals_at_[hidden]; CC:Yexuan Xiao <bizwen_at_[hidden]>; I propose a new standard attribute, [[discouraged]], and a new macro, #strict, to indicating that the name or entity declared with this attribute is discouraged from use, and giving an alternative.   [[discouraged( string-literal )]] string-literal - an unevaluated string literal that could be used to explain the rationale for discouragement and to suggest a replacing entity   macro #strict #strict can appear anywhere in the file, and once the file contains this macro, the compiler will generate warnings for all uses of names and syntax that are marked as discouraged, and give the reason.   Full proposal written with bikeshed here: https://api.csswg.org/bikeshed/?url=https://storage.nykz.org/proposals/keeping-cxx-young.bs&force=1. -- Std-Proposals mailing list Std-Proposals_at_[hidden] https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals  

Received on 2023-11-06 12:09:26