Jump to content

Arvid P.

Members
  • Content Count

    4
  • Joined

  • Last visited

Community Reputation

0 Neutral
  1. Arvid P.

    NULL iterators in C++ Builder - 32 bit vs. 64 bit

    Right, the first pattern ist what is used in the program. I didn't have the time yet to try the optional approach since the 64 bit conversion isn't the highest priority right now in the project. I have to talk with my project manager about it. But I think that's the way to go.
  2. Arvid P.

    NULL iterators in C++ Builder - 32 bit vs. 64 bit

    Thanks everyone for your suggestions. Using an optional as a wrapper for the iterator sounds like a great idea! I'll try that and let you know how I fared. In my defense, this is a very old project and I'm not the original developer. This concept was used in some classes and I used it for others that I added. So unfortunately I'll have to change quite a lot of classes since no inheritance was used. I guess I'll fix that too. Thanks again, you were a great help!
  3. Arvid P.

    NULL iterators in C++ Builder - 32 bit vs. 64 bit

    Hi Remy, thanks for the quick reply and sorry for the late reaction. Let me give you a generalized example. So let's say there's a class called MyType and another called MyTypes In the header of MyTypes is defined as private: std::list<MyType*> mLstMyTypes; std::list<MyType*>::const_iterator mp1MyType; MyTypes has public methods like: void MyTypes::first() { mp1MyType = NULL; } bool MyTypes::next() { if ( mp1MyType == NULL ) { mp1MyType = mLstMyTypes.begin(); } else { mp1MyType++; } if ( mp1MyType == mLstMyTypes.end() ) { mp1MyType = NULL; return false; } else { return true; } } MyType* MyTypes::getPresent() const { if ( mp1MyType == NULL ) { return NULL; } else { return *mp1MyType; } } I would use these in other places to iterate through the list (that was created from a SQL query when creating the instance of MyTypes). Somehow, this used to work in 32 bit, although it apparently shouldn't. I wasn't aware of that until I started researching the reason for these errors. What can be done?
  4. Hello community, this is driving me crazy, maybe someone can give me some insight. I have a project originally developed in C++ Builder 2007, that was recently converted to C++ Builder 12, which was already a lot of work. The next step wuld be to turn it from 32 bit into a 64 bit program. Of course, new compiler and linker errors appear and code has to be adapted. But this one really puzzles me: We have some classes that are wrappers for a list of other classes and have a publicly declared iterator for that list. This iterator was intialized as NULL, sometimes set to NULL and checked against NULL. This worked perfectly fine in 32 bit. But compiling in 64 bit gives linker errors like this: I did a lot of Google searching and everywhere it says setting iterators to NULL is absolutely not possible in C++. But nowhere I find reference to it being possible in C++ Builder which it definitley is - just not in 64 bit, apparently. Can anyone confirm that that is the case? And maybe give some hints how I can solve the issue without completely rewriting these classes? If it is at all possible... Thanks a lot in advance!
×