Jump to content

Fraser

Members
  • Content Count

    64
  • Joined

  • Last visited

Everything posted by Fraser

  1. #include <vcl.h> #pragma hdrstop #include "Unit1.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; class A { A() noexcept try { throw std::logic_error("test"); } catch (std::exception const &ex) { std::cout << "Caught an STL exception" << std::endl; } }; A a; A & AccessA() { static A obj; return obj; } //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- The throw is placed there as a deliberate test. The object a throws an exception and it gets caught by the handler but the CPU view shows that a function called clang terminate is called. The object obj throws an exception and it gets caught by the handler and the correct code is executed.
  2. Are there any open source projects for C++ Builder that could be used for this kind of problem?
  3. I've tried that and the bug has not materialised. Probably it requires a large project to appear.
  4. What appears to be required is a VCL project with an object declared at global scope that throws during construction and an appropriate catch statement in the constructor that will not catch the exception.
  5. An object is declared in a cpp file at namespace scope.
  6. I am using C++ Builder 10.4 with Dinkumware 8.03. The non-member function std::cbegin sometimes returns an iterator when it should always be a const_iterator. The following program will not compile due to b1 being deduced as iterator and b2 a const_iterator. There is no problem with c1 and c2. The fix is to add const to the parameter _Container & as described in the book. int _tmain(int argc, _TCHAR* argv[]) { std::vector<int> a1(100, 2); std::vector<int> const a2(100, 3); auto const b1= std:: cbegin(a1), b2= std::cbegin(a2); /*auto const c1= a1.cbegin(), c2= a2.cbegin(); */ // See item 13 of Effective Modern C++ for explanation. return 0; } /* line 1672 of xiter template<class _Container> _CONST_FUN auto inline cbegin(_Container& _Cont) _NOEXCEPT_OP(_NOEXCEPT_OP(_STD begin(_Cont))) -> decltype(_STD begin(_Cont)) { // get beginning of sequence return (_STD begin(_Cont)); } */
  7. Fraser

    std::cbegin can return an iterator

    I've not had any reply from Dinkumware.
  8. Fraser

    std::cbegin can return an iterator

    The same problem occurs with std::cend. It is easily fixed by inserting const. I have reported this to Dinkumware.
  9. Fraser

    AnsiString oddities

    There is something not right with the integrated debugger. If you step into the concatenation and out again you will see what you expect. Is it a mistake that you assign a wide character string literal to a char based string type?
  10. Fraser

    shortcuts missing

    On my Windows start button menu some shortcuts of C++ Builder are missing from view but they are present in C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Embarcadero RAD Studio 10.1 Berlin. With 10.4 Rad Studio Command Prompt and Uninstall are missing and with 10.3 only Uninstall is missing. With 10.1 another couple are missing.
  11. Fraser

    code completion?

    The <> syntax is used to include library headers and that can include your own library code shared by multiple projects.
  12. Fraser

    code completion?

    After typing #include < there is a selection box with file names. If I ignore that something gets selected anyway and characters from a file name are inserted. I would like to turn it off.
  13. Fraser

    DLL without underscore mangled functions

    I use extern "C" to prevent name mangling like this; extern "C" { __declspec(dllexport) signed char __stdcall MajorVersion() { return 1; }; }
  14. Fraser

    code completion?

    When I type #include < characters get entered automatically that I don't want. I'm not sure what this technology is called but it is a pain. I have some of my own headers that I include with <> because they are used by multiple projects. How is this turned off? I have 10.4 Community.
×