June 06, 2002 Re: #pragma pack equivalent? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | Does it work on module-scope globals too? align(1): struct foo { byte a,b; } struct bar { char c,d; } Sean "Pavel Minayev" <evilone@omen.ru> wrote in message news:adli7a$16m1$1@digitaldaemon.com... > "Sean L. Palmer" <seanpalmer@earthlink.net> wrote in message news:adlgtt$15fq$1@digitaldaemon.com... > > > I'm translating DirectX 8 to D and ran into some #pragma pack to control struct member alignment. Is there any equivalent for this in DMD? (even > if > > it's not "standard" D) > > Standartized D equivalent is the align() attribute. It can be applied both to entire structures, and to their parts: > > align(1) struct foo // align entire struct on bytes boundaries > { > byte a; > int b; > } > > struct bar > { > align(2): // align on word boundaries from now on > byte a; > int b; > align(4): // align on dword boundaries from now on > short c; > long d; > } > > |
June 06, 2002 Re: Phobos cross-platform networking layer? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan Andrew | "Jonathan Andrew" <jon@ece.arizona.edu> wrote in message news:3CFE7DA9.7050308@ece.arizona.edu... > How difficult do you think it would be to package up those functions into a 'socket' or 'connection' class? I'm not much of an OO fan myself, socket.d does exactly this. > but net programming always seemed like an appropriate place for it. Maybe we could have a seperate class-based interface called net.d that is slightly higher-level than socket.d? Just a thought... You mean like a set of clients and servers for various protocols? It could be done... |
June 06, 2002 Re: #pragma pack equivalent? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean L. Palmer | "Sean L. Palmer" <seanpalmer@earthlink.net> wrote in message news:admqpu$2d6i$1@digitaldaemon.com... > Does it work on module-scope globals too? > > align(1): > struct foo { byte a,b; } > struct bar { char c,d; } Not sure. I think so (since it's an attribute like all others), but it should be tested. |
June 06, 2002 Re: Phobos cross-platform networking layer? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | Pavel Minayev wrote: > "Jonathan Andrew" <jon@ece.arizona.edu> wrote in message > news:3CFE7DA9.7050308@ece.arizona.edu... > > >>How difficult do you think it would be to package up those functions >>into a 'socket' or 'connection' class? I'm not much of an OO fan myself, >> > > socket.d does exactly this. > Ah, I hadn't yet had a chance to look at it, and assumed from your earlier comments that it was just wrappers to make it easier to call the socket function from a D program, instead of putting everything in nice classes. I'm glad you did it the way you did though, I like it. Now if I can just get some time to play with it! > >>but net programming always seemed like an appropriate place for it. >>Maybe we could have a seperate class-based interface called net.d that >>is slightly higher-level than socket.d? Just a thought... >> > > You mean like a set of clients and servers for various protocols? > It could be done... > Well, to be honest I was just thinking of what you have already done with socket.d, but a set of classes for different protocols would be very cool, have some base connection class and then have things like FTPConnection, HTTPConnection, etc... all derived from that class. I don't think it would belong in Phobos though. -Jon |
Copyright © 1999-2021 by the D Language Foundation