December 18, 2001 Re: D vs. LX - Exceptions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean L. Palmer | "Sean L. Palmer" a écrit :
> Something I'm really going to miss I think in D is guaranteed order of destruction. I oftentimes use a class as a convenient way to automatically run ctor and dtor code for initialization and cleanup. I have to use smart pointer classes to get that, but it's worth it.
I've never realised that (ready D specs, it's time i try it..)
For example in C++:
class LockDevice {
public:
LockDevice() {
++_busy; //atomic
}
~LockDevice() {
_busy--; //atomic
}
int isbusy() {
return (_busy!=0);
}
int busylevel() {
return _busy;
}
private:
static int _busy;
};
int LockDevice::_busy = 0;
void workondevice() {
LockDevice lock; //lock device acces
if (lock.busylevel()>1) then goto device_is_already_locked;
.
<work on device>
.
} //~LockDevice automaticaly unlock device
Can i do something similar in D ?
Roland
|
December 19, 2001 Re: D vs. LX - Exceptions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Roland | You can use the synchronize statement to achieve the same affect, at least for locking. Otherwise, you'll need to wrap the code in a try-finally statement. "Roland" <rv@ronetech.com> wrote in message news:3C1FB8E7.BAEE94DF@ronetech.com... > "Sean L. Palmer" a écrit : > > > Something I'm really going to miss I think in D is guaranteed order of destruction. I oftentimes use a class as a convenient way to automatically > > run ctor and dtor code for initialization and cleanup. I have to use smart > > pointer classes to get that, but it's worth it. > > I've never realised that (ready D specs, it's time i try it..) > For example in C++: > > class LockDevice { > public: > LockDevice() { > ++_busy; file://atomic > } > ~LockDevice() { > _busy--; file://atomic > } > > int isbusy() { > return (_busy!=0); > } > int busylevel() { > return _busy; > } > private: > static int _busy; > }; > > int LockDevice::_busy = 0; > > void workondevice() { > LockDevice lock; file://lock device acces > if (lock.busylevel()>1) then goto device_is_already_locked; > . > <work on device> > . > } file://~LockDevice automaticaly unlock device > > Can i do something similar in D ? > > Roland > > > |
December 19, 2001 D and DOSX | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | Walter a écrit :
> You can use the synchronize statement to achieve the same affect, at least for locking. Otherwise, you'll need to wrap the code in a try-finally statement.
>
nice
any plan to port D on DOSX ? does it seem complicate ?
Roland
(sorrry if this question had already been asked, this group is too fast and
flight too high for me)
|
December 19, 2001 Re: D and DOSX | ||||
---|---|---|---|---|
| ||||
Posted in reply to Roland | "Roland" <rv@ronetech.com> wrote in message news:3C20B16D.5389BC0D@ronetech.com... > Walter a écrit : > > > You can use the synchronize statement to achieve the same affect, at least > > for locking. Otherwise, you'll need to wrap the code in a try-finally statement. > > > > nice > > any plan to port D on DOSX ? does it seem complicate ? > > Roland > > (sorrry if this question had already been asked, this group is too fast and > flight too high for me) The only barrier to running D under DOSX is porting the runtime library. |
December 20, 2001 Re: D and DOSX | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter |
Walter a écrit :
> > any plan to port D on DOSX ? does it seem complicate ?
> >
> > Roland
> >
> The only barrier to running D under DOSX is porting the runtime library.
The good news is that it doen't seem too complicate
The bad news is that i can't propose my help at this moment and may be Linux
will come first ?
Thanks
Roland
|
December 20, 2001 Re: D and DOSX | ||||
---|---|---|---|---|
| ||||
Posted in reply to Roland | "Roland" <rv@ronetech.com> wrote in message news:3C21E0E6.E9A2C732@ronetech.com... > Walter a écrit : > > > any plan to port D on DOSX ? does it seem complicate ? Roland > > The only barrier to running D under DOSX is porting the runtime library. > The good news is that it doen't seem too complicate > The bad news is that i can't propose my help at this moment and may be Linux > will come first ? > Thanks > Roland I won't myself be doing the linux port, I have a partner in crime who's looking into it. Porting the phobos rtl shouldn't be too hard. Don't ask for a 16 bit port <g>. |
December 20, 2001 Re: D and DOSX | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "Walter" <walter@digitalmars.com> wrote in message news:9vt62f$1em4$3@digitaldaemon.com... > I won't myself be doing the linux port, I have a partner in crime who's looking into it. Porting the phobos rtl shouldn't be too hard. Don't ask for > a 16 bit port <g>. Oh my god, please, no, I want to make .com files with D! =) |
Copyright © 1999-2021 by the D Language Foundation