Fraser
-
Content Count
44 -
Joined
-
Last visited
Posts posted by Fraser
-
-
I had discovered some of this. The documentation needs some correcting.
-
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.'
-
#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.
-
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.
-
Are there any open source projects for C++ Builder that could be used for this kind of problem?
-
I've tried that and the bug has not materialised. Probably it requires a large project to appear.
-
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.
-
An object is declared in a cpp file at namespace scope.
-
If I have an object with static storage duration that throws an exception while constructing it is not caught by the expected catch statement. Instead there is an external exception EEFACE and 'Abnormal program termination' is reported. This only happens with a VCL application. The code would work otherwise. I have to have my object declared static in a function that returns it by reference in order that its construction will be delayed until after something clearly VCL related. This must be something that is known about. I am not providing example code because the requirements for this are described adequately. BTW this is not the undeterminable order of construction of objects of static storage duration problem.
-
I've not had any reply from Dinkumware.
-
The same problem occurs with std::cend. It is easily fixed by inserting const. I have reported this to Dinkumware.
-
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));
} */ -
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?
-
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.
-
The <> syntax is used to include library headers and that can include your own library code shared by multiple projects.
-
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.
-
I use extern "C" to prevent name mangling like this;
extern "C" {
__declspec(dllexport) signed char __stdcall MajorVersion() {
return 1;
};
} -
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.
- 1
exceptions and static storage duration objects
in General Help
Posted
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.