This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/78822] [cleanup] replace static char buffers by std:string
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 16 Dec 2016 12:27:09 +0000
- Subject: [Bug fortran/78822] [cleanup] replace static char buffers by std:string
- Auto-submitted: auto-generated
- References: <bug-78822-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78822
--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
BTW, yet another option (and I'd say much more readable) is just using
build_message_string function, so
snprintf (errmsg, err_len, "Rank mismatch in argument '%s' (%i/%i)",
s1->name, symbol_rank (s1), symbol_rank (s2));
would be converted to
*errmsg
= build_message_string ("Rank mismatch in argument '%s' (%i/%i)",
s1->name, symbol_rank (s1), symbol_rank
(s2));
etc.
The caller would need to free it afterwards. Note, the Fortran FE already uses
this function as well.