![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Forward Declarations??? Topic Summary: How to Forward declare methods over come Global namespace Created On: 12-Jan-2007 15:45 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
I want to know if dxl supports forward declarations as would be found in C++. I want to forward declare methods (functions for those not familiar with OO concepts) so I can predefine the method and interface to that method. Thus I can create my GUI layout cleanly in one section of code and call the forward declared methods that then dispatch calls to the appropriate "worker" methods.
For example I create a GUI layout that has the following in this order : ---------------------------------------------------------------------------------------------------------------------------- fileName (fileSelector ) fileName button ( callback to a method that does work but needs to populate the text box or listbox with data - the list box is declared and defined later) seperator seperator listBox (the data from earlier) fileName button - allows user to output the data from the listBox to a selected file ----------------------------------------------------------------------------------------------------------------------- I want to do all the GUI code together without interspersing call back methods within it. If not, how does everyone create an interface where you may have a text box or list box that reports results in a list format, but may then later want to extract that data in a method later. Or does everyone create everything in the Global namespace and pray that then there are no collisions later. Sorry, but I am a software engineer that was assigned DOORS as an add on task and I just shudder at anything being placed in the global namespace. In my view of the world things should be scoped nicely to live and die within the stack if at all possible and thus limit the program or script's footprint in memory and the chance of memory leak Sorry for the philosophizing. Thanks, Marlin Edited: 12-Jan-2007 at 16:10 by Marlin Wegner |
|
![]() |
|
![]() |
|
I'm not familiar with C. My partner years ago did seem to do something that looked like your forward references; functions were 'declared' at the top of the main but contained no braces; these functions were actually included later on down in the code:
void CheckValue(string Value) void DealWithValue(string Value) I didn't understand it. I also didn't understand why he would want to do that, other than to list the functions that were used by the main script; but he could have done that in a comment block. Don't understand your problem with interspersion. All my GUI is always together, callback functions are grouped above it. Don't understand about praying there are no collisions. Are you suggesting that your local functions may have the same name and paramaters and return type as some global library function? If so, adopt a naming convention for your library; mine start with "f". - Louie |
|
![]() |
|
![]() |
|
Reply given by Thomas Fürer about 5 oct 2005
The answer is simple. Write the function head with a semicolon but without named parameters, e.g.: void treeWalk(string&, Project, int); and it will work :-)
----
it's somewher in the archive
|
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Forward Declarations???
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.