https://gustedt.wordpress.com/2025/04/06/make-c-string-literals-const/ Skip to content Jens Gustedt's Blog Make C string literals const? Martin Uecker has started a new initiative to ensure a better const contract for C2y: change the type of string literals to a const-qualified base type, much as it is already the case in C++. Compilers support this since a very long time; some of them have this as default, some provide command line switches for that model. Nevertheless, this would be normative change and might be some burden for existing code. So, before doing this and writing papers, it would be good if we had an idea of the impact of such a change in existing code bases. I would be very grateful if we'd receive feedback from you along the lines of * You have a project that already uses options such as gcc's -Wwrite-strings (or even a compiler with such a default) to have all string literals const-qualified. * You have a project and you tested it with such options and introducing this change would be easy. (If so does this change expose some qualification bugs in your code base?) * You have a project and you tested it with such options, but introducing this permanently into your code base would be a real pain. * Your project does not care about const and you wouldn't even know where to begin. If it were introduced in a future version of C, you probably you would have to use the command line to switch such a feature off. The goal here is not to have an opinion poll or similar; I am not convinced that such polls on some random blog like mine have any particular meaning. I really like to have facts first, not opinions: * If it is open source, please give a pointer to your project. Otherwise, please describe your project e.g if it is a commercial product of your company or employer. But please, do not share confident information that could get you in trouble. * Report on your experience with these kind of options for const qualification. * Don't speculate about what could happen, restrict yourself to facts. Share this: * Share * * Email * Print * Facebook * Twitter * Related [1852c]Author Jens GustedtPosted on April 6, 2025April 6, 2025 Categories C2y Leave a comment Cancel reply This site uses Akismet to reduce spam. Learn how your comment data is processed. Post navigation Previous Previous post: A diagram of C23 basic types - [1852c43e] Mastodon C as a language [dotd_newmeap_gustedt21-1] Copyright (c) 2010-2024 Jens Gustedt, Strasbourg, France eLlipsis a language independent preprocessor P99 macros for C99 emulation of C11 Categories * C++ (10) * C11 (45) + defects (11) + feature request (2) + library (9) * C17 (11) * C2x (28) + C23 (20) * C2y (1) * C99 (79) + integers (14) + language (34) + P99 (17) + preprocessor (17) + syntax (18) * compiler optimization (5) * core (3) * ellipsis (2) * eLlipsis (5) * fediverse (1) * lock structures (8) * macros (5) * Modern C (3) * Modular C (5) * POSIX (14) + linux (3) * rants (5) * Uncategorized (1) Recent Posts * Make C string literals const? * A diagram of C23 basic types * Contracts for C * Preprocessor meta-quotes with eLlipsis * Simple defer, ready to use Top Posts & Pages * Make C string literals const? * Simple defer, ready to use * The C23 edition of Modern C * A diagram of C23 basic types * Contracts for C * Modern C is now feature complete * C data model, simplified view * All chapters of the C23 edition of Modern C now available in early access * Name mangling in C * A defer feature using lambda expressions Search for: [ ] Search related * C99 * c threads * define * elif * endif * preprocessor * undef Follow Blog via Email Enter your email address to follow this blog and receive notifications of new posts by email. Email Address: [ ] Follow Join 209 other subscribers Meta * Register * Log in * Entries feed * Comments feed * WordPress.com Archives * April 2025 * March 2025 * February 2025 * January 2025 * October 2024 * September 2024 * July 2024 * June 2024 * May 2024 * February 2024 * January 2024 * December 2023 * October 2023 * August 2023 * June 2023 * December 2022 * January 2022 * October 2021 * January 2021 * December 2020 * November 2020 * June 2020 * May 2020 * March 2020 * September 2019 * August 2018 * June 2018 * April 2018 * August 2017 * May 2017 * March 2017 * January 2017 * November 2016 * September 2016 * August 2016 * July 2016 * July 2015 * May 2015 * April 2015 * February 2015 * October 2014 * September 2014 * April 2014 * December 2013 * October 2013 * August 2013 * July 2013 * February 2013 * December 2012 * November 2012 * October 2012 * August 2012 * July 2012 * May 2012 * April 2012 * March 2012 * February 2012 * January 2012 * December 2011 * November 2011 * October 2011 * July 2011 * June 2011 * March 2011 * February 2011 * January 2011 * December 2010 * November 2010 * October 2010 * September 2010 * August 2010 * July 2010 * June 2010 RSS RSS Feed RSS - Posts RSS Feed RSS - Comments - Jens Gustedt's Blog Blog at WordPress.com. [Close and accept] Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use. To find out more, including how to control cookies, see here: Cookie Policy * Comment * Subscribe Subscribed + [wpcom-] Jens Gustedt's Blog Join 209 other subscribers [ ] Sign me up + Already have a WordPress.com account? Log in now. * + [wpcom-] Jens Gustedt's Blog + Subscribe Subscribed + Sign up + Log in + Copy shortlink + Report this content + View post in Reader + Manage subscriptions + Collapse this bar [b] Design a site like this with WordPress.com Get started