Author Topic: C++ Code Generation Bugs  (Read 4318 times)

fwoolz

  • EA User
  • **
  • Posts: 435
  • Karma: +0/-0
  • We have met the enemy, and he is us.<Pogo, 1970>
    • View Profile
C++ Code Generation Bugs
« on: December 12, 2002, 05:28:12 pm »
Hi all,

Just a note concerning a few glitches I've encountered generating C++ code & round tripping it (in EA 3.50.585):

- Class notes (comments) sometimes get duplicated several times in the generated code.
- After generating code, then renaming a class, code generation creates constructors/destructors with both the new and old class names.  This happens even after deleting the earlier source files.
- Similarly, after generating code, then renaming methods, method prototypes are generated for both the old & new names.
- Importing a declaration such as Class* m_Class[10] from a source file seems to work OK, but subsequent code generation produces Class* [10] m_Class.

Thanks...
Fred Woolsey
Fred Woolsey
Interfleet Technology Inc.

Always be ready to laugh at yourself; that way, you beat everyone else to the punch.


gsparks

  • EA User
  • **
  • Posts: 325
  • Karma: +0/-0
  • I love YaBB 1 Gold!
    • View Profile
Re: C++ Code Generation Bugs
« Reply #1 on: December 13, 2002, 05:07:08 am »
Hi Fred,

Thanks for the note.

I believe the duplicated comment issue to be fixed in the forthcoming build 587.

At the moment no methods or attributes deleted from the model are deleted from the source code. The reason being that there are no code markers so it is difficult to unambiguously recognise a function - and whether it is a previous function renamed or a something that requires deletion. This is compounded by the fact a programmer may add and delete functions from the source outside the model. For this reason these methods and attributes are left alone.

Ill check out the array declaration and see what the problem is.

Thanks again for the feedback, build 587 should be out early next week,

Cheers,
Geoff Sparks


fwoolz

  • EA User
  • **
  • Posts: 435
  • Karma: +0/-0
  • We have met the enemy, and he is us.<Pogo, 1970>
    • View Profile
Re: C++ Code Generation Bugs
« Reply #2 on: December 13, 2002, 08:50:53 am »
Geoff,

Thanks...

Perhaps I should clarify the problem with methods... it manifested itself in several ways, as follows:

With code generation set to replace (overwrite) code,

1. Methods are sometimes duplicated after changing the parameter list, sometimes with the old parameter list (ala function overloading), sometimes with the new parameter list.  This is after deleting the originally generated source code files and generating code as described above.

2. Methods with changed names appear with both the old and new names.  This is after deletion of the original source code and code generation as described above.

3. Constructors appear with both old and new class names (after renaming a class) even after the original code has been deleted and code is generated as described above.

I should think that, with the replace code option checked, code generation should start out with a blank slate, in particular when the older source code files no longer exist.

Cheers and Thanks in advance,
Fred Woolsey
Fred Woolsey
Interfleet Technology Inc.

Always be ready to laugh at yourself; that way, you beat everyone else to the punch.


mbc

  • EA User
  • **
  • Posts: 237
  • Karma: +1/-0
  • Embedded software developer
    • View Profile
Re: C++ Code Generation Bugs
« Reply #3 on: December 17, 2002, 03:16:07 am »
Fred, do you reverse engineer at all? If you do, then the methods generated at first have been imported into the model, creating duplicates.

Mikkel

fwoolz

  • EA User
  • **
  • Posts: 435
  • Karma: +0/-0
  • We have met the enemy, and he is us.<Pogo, 1970>
    • View Profile
Re: C++ Code Generation Bugs
« Reply #4 on: December 17, 2002, 06:32:51 am »
Mikkel,

I do reverse engineer... however, I've tried deleting the imported methods from the model, deleting the original source code files, and regenerating the code- still the duplication occurs.  As I said, I would expect code generation to start with a blank slate if no corresponding source code file exists in the target directory.  It's as if shadow copies of some of the deleted methods linger somewhere in the model even though they appear to have been removed (from the source code as well).

Cheers,
FCW
Fred Woolsey
Interfleet Technology Inc.

Always be ready to laugh at yourself; that way, you beat everyone else to the punch.