Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
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
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 12-Jan-2007 15:45
User is offline View Users Profile Print this message


Marlin Wegner

Posts: 20
Joined: 2-Jun-2006

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
Report this to a Moderator Report this to a Moderator
 12-Jan-2007 17:15
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

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
Report this to a Moderator Report this to a Moderator
 15-Jan-2007 11:04
User is offline View Users Profile Print this message


Robert Swan

Posts: 86
Joined: 14-Apr-2005

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
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 1 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 1 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.