Book a Demo

Author Topic: VB6 Code Generation - Comments problem  (Read 3451 times)

sbarkeruk

  • EA User
  • **
  • Posts: 31
  • Karma: +0/-0
    • View Profile
VB6 Code Generation - Comments problem
« on: November 11, 2004, 08:14:44 am »
The following problem assumes I have already created a model file, which has generated VB6 code associated with it.

If I go into the VB6 code and comment out an entire function, then (after saving and closing VB project) open the model file and do a 'generate code' or 'synchronise', the function is replaced BUT the commented function code is removed completely!!

This is NOT GOOD as the commented out function could be extremely long!

In my case I discovered this while experimenting (trying to work out how to specify an Optional parameter in an operation in the model), but this could have happened during a large project!

Any suggestions/comments?

mikewhit

  • EA User
  • **
  • Posts: 608
  • Karma: +0/-0
  • Accessing ....
    • View Profile
Re: VB6 Code Generation - Comments problem
« Reply #1 on: November 11, 2004, 08:43:49 am »
Well, I can see why: non-code (comments) does not reflect back to anything in the model; therefore does not generate any code ...

However, I would have thought that comments would be preserved ... a Code Engineering guru will probably give a definitive answer.

In these cases I tend to add 'x' to the beginning of the function name rather than commenting out !

In C or C++, I say: #if 0...#endif

sbarkeruk

  • EA User
  • **
  • Posts: 31
  • Karma: +0/-0
    • View Profile
Re: VB6 Code Generation - Comments problem
« Reply #2 on: November 11, 2004, 09:18:31 am »
Good point about the why but other comments (whether in functions or outside, i.e. top of module) do not get cleared up in this way!

To me it seems like a bit of a bug or hindsight.

mikewhit

  • EA User
  • **
  • Posts: 608
  • Karma: +0/-0
  • Accessing ....
    • View Profile
Re: VB6 Code Generation - Comments problem
« Reply #3 on: November 11, 2004, 09:40:44 am »
In the EA Help file, in the Code Generation section (page title 'Synchronizing Code'), it refers to the code template 'Operation Body' as being 'everything between the braces' of a function - I presume this is what happened to your comments.

The other comments that are preserved relate to specific code template sections.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: VB6 Code Generation - Comments problem
« Reply #4 on: November 11, 2004, 01:32:17 pm »
What I think has happened is that EA thought that the commented out function was the comment for the following method.  Which because you were generating again, it synchronised that comment with the notes of the following comment, resulting in the deletion of the comment.

You could stop this by turning off the generation of comments or by adding a comment between the two.

Hope this helps.

Simon