Board index » cppbuilder » Stack Overflow on Form Creation
sctrojan79
![]() CBuilder Developer |
sctrojan79
![]() CBuilder Developer |
Stack Overflow on Form Creation2004-04-09 08:23:17 AM cppbuilder65 Hello, I'm having trouble with adding additional constructors to forms. In most cases, the very existence of a non-default constructor will cause a 'Stack Overflow' error on form creation, even if the default constructor is called. From the C++ Builder documentation I understand this could happen from excessive recursiveness or very large calls by value, but I'm getting this error for constructors that pass merely an extra int. I recently downloaded Update 4 and it didnt help. Any ideas? Thanks |
Hans Galema
![]() CBuilder Developer |
2004-04-09 02:56:07 PM
Re:Stack Overflow on Form Creation
sctrojan79 wrote:
Quote... but I'm getting this The constructor with an int extra does already exist in the TForm class, hence the recursion. Hans. |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2004-04-09 03:24:26 PM
Re:Stack Overflow on Form Creation
"sctrojan79" < XXXX@XXXXX.COM >wrote in message
QuoteI'm having trouble with adding additional constructors to forms. introduce an endless recursion loop, because VCL constructors are virtual and TForm(TComponent*) calls TForm(TComponent*, int) internally. If your override of TForm(TComponent*, int) calls TForm(TComponent*) (which is often the case), the recursion occurs. QuoteI'm getting this error for constructors that pass merely an extra int. that you must avoid. If you must pass an extra 'int' parameter, then you must make it be the first parameter, not the second parameter, so that the function signature of your constructor is different than the signature of the native constructor, thus is won't be overriden and thus won't cause a recursive error. Gambit {smallsort} |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2004-04-09 03:26:31 PM
Re:Stack Overflow on Form Creation
"Hans Galema" < XXXX@XXXXX.COM >wrote in message
QuoteThe constructor with an int extra does already the constructor that does, and because VCL constructors are virtual, the constructor that does not take an int parameter will end up calling your overriden constructor, which will call the constructor without an int parameter, which will call your constructo, and so on endlessly until the stack overflows. Gambit |