![]() |
Telelogic Rhapsody (steve huntington) | ![]() |
Topic Title: modelling int foo(void) is NOT possible ? Topic Summary: Created On: 5-Jul-2006 08:15 Status: Read Only |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
Hi there
a problem we came across: It is a common idiom and good codingstyle (btw. some codingstandards require this) to add the "void" into the argument list of a function that takes NO parameter. so say int foo(void); instead of int foo(); Remember: just leaving the parameter list empty results in different behaviour in C/C++ (C means null or any parameter, C++ means null parameter). However with Rhapsody it seems NOT possible to modell such a operation. The tool always wants a parameter name. (which is incorrect in this case) I also searched the properties of CG and CPP_CG but found no way. any help appreciated, kind regards, Bernhard. |
|
![]() |
|
![]() |
|
Perhaps not much help, but since you're generating source code does it really matter at all? An empty parameter list in rhapsody is singular in meaning, and one would presume that when you generate code (C or C++) that the generated code will be consistant and functional.
|
|
![]() |
|
![]() |
|
Hi Bernhard
(First, just a clarification: RiCpp does use void; it's just RiC that has this issue.) I don't know of any property that can control this behaviour, and I tend to agree with Paul's view on this. However, I do have a suggested solution if you really need your voids ![]() [list=1] [*]Create a type to define (eg.) EMPTY as nothing. [*]Add parameters with the type set to void and the name set to EMPTY. [/list] The generated code would be: [CODE]/*#[ ignore */ #define EMPTY /*#]*/ ... /*## operation foo(void) */ int foo(void EMPTY);[/CODE] I know it's a bit of a hack, but... ![]() best regards, Simon ------------------------- Simon Morrish simon.morrish@eu.panasonic.com http://panasonic.co.uk Panasonic ideas for life |
|
![]() |
|
![]() |
|
Hi Simon,
thanks for your reply, but I have this issue with RiC AND RiCPP. :confused: I have to specify parameternames for void in both systems, C and C++. I do not know if UML requires this (if a parameter NAME is required) but the codegenerator should ignore this IMO. kind regards, Bernhard. |
|
![]() |
|
![]() |
|
Hi Bernhard
[QUOTE=Bernhard.Merkle@sick.de]I have to specify parameternames for void in both systems, C and C++.[/QUOTE] You're right; this is true. But if you specify no parameter, then RiC (v6.1MR1) generates: [CODE]int foo()[/CODE] while RiCpp generates: [CODE]int foo(void)[/CODE] Hopefully you see the same behaviour? For RiC, you could use my "hack" (see my previous post) to force a void, but ideally Rhapsody should be configurable to generate void-or-no-void when no parameter is specified. Perhaps it is and I just don't know it! Anyone? :confused: best regards, Simon ------------------------- Simon Morrish simon.morrish@eu.panasonic.com http://panasonic.co.uk Panasonic ideas for life |
|
![]() |
|
![]() |
|
Hello,
Try C_CG:Configuration:EmptyArgumentListName. The EmptyArgumentListName (under C_ and C_CG::Configuration) specifies the string generated for the argument list when an operation has no arguments. For example, if you set this value to ?void?, for an operation foo that has no arguments, Rhapsody generates the following code: void noargFunc(void); Best Regards, Beery |
|
![]() |
|
![]() |
|
[QUOTE]
But if you specify no parameter, then RiC (v6.1MR1) generates: [CODE]int foo()[/CODE] while RiCpp generates: [CODE]int foo(void)[/CODE] Hopefully you see the same behaviour? [/QUOTE] I have Rhapsody 6.2 here, and I do NOT get int foo(void) in C++ so I do NOT see the same behaviour (unfortunately) Instead I get int foo() in C++ !?? :confused: Have you changed/overwritten any CG/CPP_CG properties ? |
|
![]() |
|
![]() |
|
Did you try to overide the property in the configuration level?
Thanks, Beery |
|
![]() |
|
![]() |
|
Hi Beery,
great this is exactly what i was looking for. ![]() thanks for your help, Bernhard. |
|
![]() |
Telelogic Rhapsody
» Rhapsody Category » Rhapsody
»
modelling int foo(void) is NOT possible ?
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.