Thread: Re: [Dev-C++] overloading delete
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Hossein H. <ult...@em...> - 2003-07-15 18:16:00
|
Dear Daniel, > What parameters does delete take? I'm being told by the compiler the first > is __segment and the second is a __based(void)* ????? > Is this right? If you only want the arguments, the following (the full signature) will convince you: void* operator delete(void*) throw(); void* operator delete [] (void*) throw(); I cite them directly from the Standard draft. But if you need more information take a look to Section 3.7.3.2 (Deallocation functions) in Standard. I don't have Accrobat Distiller. If I had I would send you the wholl chapter as a pdf file. You will also find good stuff in TC++PL:Spec. E.g., consider Section 6.2.6.2, Section 15.6.1, and (the best at) Section 19.4.5. Regards, --Hossein -- __________________________________________________________ Sign-up for your own FREE Personalized E-mail at Mail.com http://www.mail.com/?sr=signup CareerBuilder.com has over 400,000 jobs. Be smarter about your job search http://corp.mail.com/careers |
|
From: Daniel G. <sp...@ho...> - 2003-07-15 18:57:35
|
I found another
(from memory) it was:
void* operator delete(_segment Seg, void* _based(void*) BasePtr, void*
Memory)
the variable names are my own, but I think the types are right. This is for
segments.
My problem needed a call to _ffree, but you cannot access the C runtime
library from another segment except the DEFAULT segment. So from your
segment you call your operator delete which calls your stub function (a
function in the DEFAULT segment) that then calls _ffree.
#include "SomeHeader.h" // Default seg header with MyDelete()
#pragma codeseg("MYSEG_SEG") // something like this
void operator delete (params here)
{
MyDelete(params); // Calls MyDelete which calls _ffree()
}
void SomeFunc()
{
// Create obj
delete obj;
}
>From: "Hossein Haeri" <ult...@em...>
>To: dev...@li...
>Subject: Re: [Dev-C++] overloading delete
>Date: Tue, 15 Jul 2003 13:15:09 -0500
>
>Dear Daniel,
>
> > What parameters does delete take? I'm being told by the compiler the
>first
> > is __segment and the second is a __based(void)* ?????
> > Is this right?
>
>If you only want the arguments, the following (the full signature) will
>convince you:
>
>void* operator delete(void*) throw();
>void* operator delete [] (void*) throw();
>
>I cite them directly from the Standard draft. But if you need more
>information take a look to Section 3.7.3.2 (Deallocation functions) in
>Standard. I don't have Accrobat Distiller. If I had I would send you
>the wholl chapter as a pdf file.
>
>You will also find good stuff in TC++PL:Spec. E.g., consider Section
>6.2.6.2, Section 15.6.1, and (the best at) Section 19.4.5.
>
>Regards,
>--Hossein
>
>
>--
>__________________________________________________________
>Sign-up for your own FREE Personalized E-mail at Mail.com
>http://www.mail.com/?sr=signup
>
>CareerBuilder.com has over 400,000 jobs. Be smarter about your job search
>http://corp.mail.com/careers
>
>
>
>-------------------------------------------------------
>This SF.Net email sponsored by: Parasoft
>Error proof Web apps, automate testing & more.
>Download & eval WebKing and get a free book.
>www.parasoft.com/bulletproofapps1
>_______________________________________________
>Dev-cpp-users mailing list
>Dev...@li...
>TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
>https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
_________________________________________________________________
Hotmail messages direct to your mobile phone http://www.msn.co.uk/msnmobile
|
|
From: Hossein H. <ult...@em...> - 2003-07-15 19:10:20
|
Dear Per, > The void* parameter of delete is only guaranteed in linear addressing > mode. For 16-bit segmented code, delete might take a couple of other > parameter types, depending on memory model used. > > It might take void __near* and void __far *. > > The void __far * is for 16-bit Intel composed of a 16:16 bit pointer, > where the first 16 bit are the segment, and the next 16 bit are offset. > > However, a 16:16 pointer is still treated as a single parameter in the > code, i.e. you still write "delete myobj;", where myobj contains a pointer > returned by new. > > It is just code performing advanced pointer manipulation that needs to > know that the pointer is segmented. For memory areas < 64kB this isn't > a problem since the offset part spans 64kB. Arrays and memory blocks > larger than 64kB do require special treatment, such as conversion to void > __huge * to make sure that the offset part is always normalized 0..15 and > the segment is constantly adjusted too. You'r absolutely right! Thanks for reminding. Wishes, --Hossein -- __________________________________________________________ Sign-up for your own FREE Personalized E-mail at Mail.com http://www.mail.com/?sr=signup CareerBuilder.com has over 400,000 jobs. Be smarter about your job search http://corp.mail.com/careers |
|
From: Hossein H. <ult...@em...> - 2003-07-15 19:25:11
|
Daniel,
> I found another
>
> (from memory) it was:
> void* operator delete(_segment Seg, void* _based(void*) BasePtr, void*
> Memory)
>
> the variable names are my own, but I think the types are right. This is for
> segments.
>
I really do not remeber if that's mentioned in the Standard, nor am I
in the mood of finding such a fine in it (needle in a haystack).
> My problem needed a call to _ffree, but you cannot access the C runtime
> library from another segment except the DEFAULT segment. So from your
> segment you call your operator delete which calls your stub function (a
> function in the DEFAULT segment) that then calls _ffree.
>
> #include "SomeHeader.h" // Default seg header with MyDelete()
>
> #pragma codeseg("MYSEG_SEG") // something like this
>
> void operator delete (params here)
> {
> MyDelete(params); // Calls MyDelete which calls _ffree()
> }
>
> void SomeFunc()
> {
> // Create obj
> delete obj;
> }
I'm not sure if this is Standard-compliant. It more seems to me to be
Implementation-Specific, isn't it? I rememeber reading interesting
points in Help documentations of BCB6. Maybe not a bad idea to try the
Help documentation of your own implementation.
I will return on it as I got in the mood. I will check BCB6 for you,
and if I had enough time, I will look it up in Standard as well!
Regards,
--Hossein
--
__________________________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup
CareerBuilder.com has over 400,000 jobs. Be smarter about your job search
http://corp.mail.com/careers
|
|
From: Ioannis V. <iv...@em...> - 2003-07-15 20:20:56
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Hossein Haeri > Sent: Tuesday, July 15, 2003 10:23 PM > To: dev...@li... > Subject: Re: [Dev-C++] overloading delete > > > Daniel, > > > I found another > > > > (from memory) it was: > > void* operator delete(_segment Seg, void* _based(void*) > BasePtr, void* > > Memory) > > > > the variable names are my own, but I think the types are > right. This is for > > segments. > > > > I really do not remeber if that's mentioned in the Standard, nor am I > in the mood of finding such a fine in it (needle in a haystack). The above are not standard compliant. The basic headers one can define void *operator new(size_t); void operator delete(void *); void *operator new[](size_t); void operator delete[](void *); The way how to do that is enough stuff in TC++PL, 10.4.11, 15.6, 19.4.5. But they are standard compliant. Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL 1: http://run.to/noicys * Alternative URL 2: http://www.noicys.cjb.net |
|
From: Per W. <pw...@ia...> - 2003-07-15 18:31:44
|
The void* parameter of delete is only guaranteed in linear addressing mode. For 16-bit segmented code, delete might take a couple of other parameter types, depending on memory model used. It might take void __near* and void __far *. The void __far * is for 16-bit Intel composed of a 16:16 bit pointer, where the first 16 bit are the segment, and the next 16 bit are offset. However, a 16:16 pointer is still treated as a single parameter in the code, i.e. you still write "delete myobj;", where myobj contains a pointer returned by new. It is just code performing advanced pointer manipulation that needs to know that the pointer is segmented. For memory areas < 64kB this isn't a problem since the offset part spans 64kB. Arrays and memory blocks larger than 64kB do require special treatment, such as conversion to void __huge * to make sure that the offset part is always normalized 0..15 and the segment is constantly adjusted too. /Per W On Tue, 15 Jul 2003, Hossein Haeri wrote: > Dear Daniel, > > > What parameters does delete take? I'm being told by the compiler the first > > is __segment and the second is a __based(void)* ????? > > Is this right? > > If you only want the arguments, the following (the full signature) will > convince you: > > void* operator delete(void*) throw(); > void* operator delete [] (void*) throw(); > > I cite them directly from the Standard draft. But if you need more > information take a look to Section 3.7.3.2 (Deallocation functions) in > Standard. I don't have Accrobat Distiller. If I had I would send you > the wholl chapter as a pdf file. > > You will also find good stuff in TC++PL:Spec. E.g., consider Section > 6.2.6.2, Section 15.6.1, and (the best at) Section 19.4.5. > > Regards, > --Hossein > > > -- > __________________________________________________________ > Sign-up for your own FREE Personalized E-mail at Mail.com > http://www.mail.com/?sr=signup > > CareerBuilder.com has over 400,000 jobs. Be smarter about your job search > http://corp.mail.com/careers > > > > ------------------------------------------------------- > This SF.Net email sponsored by: Parasoft > Error proof Web apps, automate testing & more. > Download & eval WebKing and get a free book. > www.parasoft.com/bulletproofapps1 > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |