Multi-line comment style in rtwbuild code generation.

I am using Simulink/Embedded Coder to generate C++ code from MATLAB functions in MATLAB R2018a.
I have observed that multi-line comments
% My
% multi-line
% comment
result in the following C++ code
/* My */
/* multi-line */
/* comment */
by setting the 'CommentStyle' parameter to 'Multi-line' in the Simulink Coder model configuration parameters.
Especially for multi-line comments along several lines, the trailing */ in each comment line looks rather cluttered. Is there a way or parameter to get something like the C++ code below?
/* My
* multi-line
* comment
*/

4 commentaires

db1024
db1024 le 6 Mai 2019
Modifié(e) : db1024 le 6 Mai 2019
I updated the release, since the issue is also occuring in MATLAB R2019a (Update 1).
Rik
Rik le 18 Jan 2022
It seems fairly easy to fix yourself in the resulting file (although I must admit the parameter name sounds like it should do it already for you).
Maybe it only does it for comment block (the %{ and %}).
Hi Rik, thx for your answer. I tried it with MATLAB R2021b (Update 2) and Embedded Coder. I am still getting the same behavior.
A multi-line comment
% This is
% a multi-line
% comment.
is translated to
/* This is */
/* a multi-line */
/* comment. */
and a block comment
%{
This is
a multi-line
block comment.
%}
is translated to
/* { */
/* This is */
/* a multi-line */
/* block comment. */
/* } */
Rik
Rik le 18 Jan 2022
I would suggest submitting a bug report or an enhancement request. The parameter name sounds like it should generate the style you indicated.
Maybe this is to increase portability of code. If know that for C not all compilers will accept multi-line comments.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Deployment, Integration, and Supported Hardware dans Centre d'aide et File Exchange

Question posée :

le 29 Avr 2019

Commenté :

Rik
le 18 Jan 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by