On 08/06/14 14:41, Adriano dos Santos Fernandes wrote: > On 06/08/2014 06:48, Alex Peshkoff wrote: >> On 08/05/14 16:11, Adriano dos Santos Fernandes wrote: >>> On 05/08/2014 08:20, Alex Peshkoff wrote: >>>> As the result we get language-neutral compiler-independent ABI, with an >>>> ability to generate a kind of headers for any language, with a machine >>>> generated code to catch exceptions into status vector and raise them >>>> from it (if language supports certainly), with our own structure of >>>> virtual table and therefore absolutely stable and clear interface >>>> version upgrade and (as additional small bonus) we nned not count >>>> interface versions manually. >>> I'll do a more detailed check later. This is very close with something I >>> started implement before (using only macros) and stopped most due to: >>> - How do you wanna going to catch-throw automatically and maintain the >>> warnings in the status vector? >> I want to have warnings in IStatus separate from errors (keeping them in >> same status vector IMO artifact of isc api). I think that after it this >> is not big problem. Am I missing something obvious? Certainly user must >> check for warnings himself. > Just that if one uses the C++ API and does not care about warnings, > he'll still need to pass IStatus everywhere.
With your suggestion below we may let him pass NULL in that case. >>> - Who is going to initialize status vectors? >> This is not directly related here, but it seems possible to reset errors >> in IStatus right after copying them to StatusException but before >> throwing it. But still remains a problem - who will remove warnings from >> IStatus? >> >>> - Will status vector always be checked or only depending on the >>> functions return value? >> Currently we have a lot of void functions, but certainly they can be >> made to return boolean, therefore avoiding a need in a check if non-zero >> is returned (non-zero can be also valid pointer to interface, number of >> bytes read from blob, etc.). I.e. if we may tune API to make error >> possible only in case of false/zero/NULL returned, we may in many cases >> avid a need in checking IStatus explicitly. >> >> > About reset and return values, I'm not talking directly about speedy, > but about rules and conventions. > > Say the C++ API. It can use something like: > > void method(IStatus* userStatus) > { > LocalStatus localStatus; > vtable->method(this, localStatus); > if (localStatus.isDirty()) > { > localStatus.copyTo(userStatus); > throw something; > } > } > > So you have status check without virtual calls. As a side effect we have to have LocalStatus class in public header, suppose it's not too big problem. What I really wonder - are we absolutely sure that creating new status instance is really faster than virtual call to check it? > > But anyway, something must be said, like, API does not initialize (to > not always call a virtual function) status vectors. Yes, this is what should be decided. > > With the current code, depending on manual IStatus, this is a nightmare, > but possible with automated C->C++ conversion. > > Yes, it appears possible one way or another. ------------------------------------------------------------------------------ Infragistics Professional Build stunning WinForms apps today! Reboot your WinForms applications with our WinForms controls. Build a bridge from your legacy apps to the future. http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel