Jump to content

Fraser

Members
  • Content Count

    44
  • Joined

  • Last visited

Everything posted by Fraser

  1. More than once I have said the AccessA() type of implementation works as expected and you say otherwise. Thats ridiculous. You are the only person that has said anything about rethowing. I have seen nothing. For a start an object of one type, in my case std::logic_error, would be rethrown as the same object. But the next exception I witness, for object a, has type EExternalException. I'm not aware of any difference between function-try-block and try-block other than a function-try-block is a like a try-block around a functions entire body, a shorter notation for that. Even the standard states that where it says "try block" it can apply to either. Here is the rough mock-up of my program with some corrections; #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; std::exit("Done"); } }; A a; // Alternative implementation that works as expected; /*A & AccessA() { static A obj; return obj; }*/ __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { }
  2. It is not my function, it's a mock-up. My function calls exit so it does not throw again and can be declared noexcept. I don't know what you are saying. a and AccessA() are diferent implementations that I am trying out and never used together. It has a handler so why wouldn't it be caught? It is caught when constructing obj. For obj's exception it is caught and the handler executes correctly and there is not another throw.
  3. Fraser

    cdecl

    I am not sure what is happening when I export functions with __cdecl. When I build with 32-bit clang there is one prefixed underscore on all function names. When I build with 64-bit clang there is no prefixed underscore on function names. The documentation says this about cdecl: "Note: This feature is available only for the classic bcc32 compiler, not for the modern Clang-enhanced compiler." It also says:"Note: The __cdecl form is the only one supported by C++Builder 64-bit Windows (BCC64)." Is this not a contradiction? The compiler option "Generate underscores on symbol names" made no difference to my 32-bit builds. I have not found any way of using cdecl with 32-bit builds and to not get leading underscores which means I cannot build zlib1.dll which specifies no underscores.
  4. Fraser

    cdecl

    I had discovered some of this. The documentation needs some correcting.
  5. For obj the initial message is Project X.exe raised exception class $std@logic_error with message 'Exception Object Address:0x2EAAE98'. For a the initial message is similar. Next there is Project X.exe raised exception class EExternalException with message 'Extrenal Exception EEFACE'. Next there is another before 'Abnormal program termination.'
  6. #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.
  7. Are there any open source projects for C++ Builder that could be used for this kind of problem?
  8. I've tried that and the bug has not materialised. Probably it requires a large project to appear.
  9. 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.
  10. An object is declared in a cpp file at namespace scope.
  11. 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)); } */
  12. Fraser

    std::cbegin can return an iterator

    I've not had any reply from Dinkumware.
  13. 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.
  14. 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?
  15. 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.
  16. Fraser

    code completion?

    The <> syntax is used to include library headers and that can include your own library code shared by multiple projects.
  17. 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.
  18. 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; }; }
  19. 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.
×