• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Function's default values are corrupted (Nasty bug)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Function's default values are corrupted (Nasty bug)


  • Subject: Re: Function's default values are corrupted (Nasty bug)
  • From: Dave Thorup <email@hidden>
  • Date: Fri, 1 Apr 2005 11:03:15 -0500

On Mar 31, 2005, at 11:08 PM, daniel wrote:

If you can't produce a simple test case, that makes me think that in the process of reducing your code, you notice that the problem goes away. If that's true then you have a lot more information you could obtain and possibly share.

Well the SetSize function is a method of a Template Class. It is defined inline in the Template declaration. I've changed it from the following (which is literally the original function):


IError * SetSize( unsigned long nWd, unsigned long nHt,
short nEx1 = -1, short nEx2 = -1, short nEx3 = -1, short nEx4 = -1 )
{
return ADDTRACEERROR( NULL, Alloc( B, nWd, nHt, nEx1, nEx2, nEx3, nEx4 ) );
}


The parameter "B" that is passed to Alloc is a generic class parameter. But I've since changed the function to this:

IError * SetSize( unsigned long nWd, unsigned long nHt,
short nEx1 = -1, short nEx2 = -1, short nEx3 = -1, short nEx4 = -1 )
{
IError * pError = NULL;

std::cout << "nWd=" << nWd << ", nHt=" << nHt << ", nEx1=" << nEx1
<< ", nEx2=" << nEx2 << ", nEx3=" << nEx3 << ", nEx4=" << nEx4 << "\n";
return pError;
}


This removes anything that is specific to the Template so that I shouldn't have to worry about the Template messing things up. But both functions still behave in the same way with regards to the corrupted parameters.

In trying to reproduce the problem I've created a simple Template Class with the SetSize function, but I haven't had any success with that yet. The only other thing I can think of is that the Template Class is derived from another class so I'm going to try to reproduce that in my test case.

One last thing (for Chris Espinosa if he's still reading), if I try to compile with -O3 optimizations I get a bus error from the compiler. This only happens now that I'm #including <iostream> for std::cout support. If I remove the calls to std::cout and don't #include <iostream> then I don't get a bus error and the file compiles.

I don't know much about C++ name mangling but I did notice that passing the symbol "Lm2EE7SetSizeEmmssss" to the c++filt command line tool doesn't seem to yield a demangling. I don't know if that's because the tool is broken or if that symbol is not a valid gcc mangled symbol. Is it possible you're compiling separate source files with different versions of gcc?

I shortened the mangled name for brevity. _____________________________

Dave Thorup
Software Engineer
email@hidden

http://www.kuwan.net
Defaults Manager - The premier editor for Mac OS X's User Defaults / Preferences database.


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Function's default values are corrupted (Nasty bug)
      • From: Dave Thorup <email@hidden>
    • Re: Function's default values are corrupted (Nasty bug)
      • From: Chris Espinosa <email@hidden>
  • Prev by Date: XCode and gcc - adding include directories
  • Next by Date: Re: Function's default values are corrupted (Nasty bug)
  • Previous by thread: Re: XCode and gcc - adding include directories
  • Next by thread: Re: Function's default values are corrupted (Nasty bug)
  • Index(es):
    • Date
    • Thread