D - Simple question
- Luigi (16/16) May 24 2002 Hello,
- Pavel Minayev (3/9) May 24 2002 Yes.
- Walter (4/12) May 24 2002 For most purposes, yes. In D, though, the parameter x gets initialized
- Pavel Minayev (5/7) May 24 2002 I thought that variables passed as inout arguments are _required_ to
- Walter (7/14) May 24 2002 All variables get initialized at some point, even if it is just to the
- OddesE (17/33) May 26 2002 variables
- Walter (3/7) Jun 05 2002 I don't remember what those keywords do.
- Matthew Wilson (10/17) Jun 05 2002 simply:
Hello, I'm italian boy and I not speak a good english, then sorry :) My question is this: a "inout" parameters of one function, are the same that a parameteres passed for address? For example: // D void foo (inout int x); // C++ void foo (int& x); are equivalent? Thank you -- Luigi E-mail: cyberboy email.it
May 24 2002
"Luigi" <cyberboy email.it> wrote in message news:aclr7o$o0j$1 digitaldaemon.com...For example: // D void foo (inout int x); // C++ void foo (int& x); are equivalent?Yes.
May 24 2002
"Pavel Minayev" <evilone omen.ru> wrote in message news:acm10f$t4f$1 digitaldaemon.com..."Luigi" <cyberboy email.it> wrote in message news:aclr7o$o0j$1 digitaldaemon.com...For most purposes, yes. In D, though, the parameter x gets initialized before being passed to foo(), this is not necessarilly so in C++.// D void foo (inout int x); // C++ void foo (int& x); are equivalent?Yes.
May 24 2002
"Walter" <walter digitalmars.com> wrote in message news:acm3ck$vbc$2 digitaldaemon.com...For most purposes, yes. In D, though, the parameter x gets initialized before being passed to foo(), this is not necessarilly so in C++.I thought that variables passed as inout arguments are _required_ to be initialized before the call... and it's out arguments which are initialized to default value; ain't I right?
May 24 2002
"Pavel Minayev" <evilone omen.ru> wrote in message news:acm6ng$12cc$1 digitaldaemon.com..."Walter" <walter digitalmars.com> wrote in message news:acm3ck$vbc$2 digitaldaemon.com...All variables get initialized at some point, even if it is just to the default value. Inout variables get initialized by the caller, out variables get initialized by the callee. C++'s inability to distinguish between an out and an inout (or even an in) is a serious bug, leading to kludge-o-matic workarounds like IDL.For most purposes, yes. In D, though, the parameter x gets initialized before being passed to foo(), this is not necessarilly so in C++.I thought that variables passed as inout arguments are _required_ to be initialized before the call... and it's out arguments which are initialized to default value; ain't I right?
May 24 2002
"Walter" <walter digitalmars.com> wrote in message news:acn93l$2028$2 digitaldaemon.com..."Pavel Minayev" <evilone omen.ru> wrote in message news:acm6ng$12cc$1 digitaldaemon.com...variables"Walter" <walter digitalmars.com> wrote in message news:acm3ck$vbc$2 digitaldaemon.com...All variables get initialized at some point, even if it is just to the default value. Inout variables get initialized by the caller, outFor most purposes, yes. In D, though, the parameter x gets initialized before being passed to foo(), this is not necessarilly so in C++.I thought that variables passed as inout arguments are _required_ to be initialized before the call... and it's out arguments which are initialized to default value; ain't I right?get initialized by the callee. C++'s inability to distinguish between an out and an inout (or even an in) is a serious bug, leading to kludge-o-matic workarounds like IDL.Well, IDL ofcourse also serves the purpose of being language independant, so you could also write IDL compilers that generate Object Pascal header files, for example... Walter is there still any need for IDL in D, or are all constructs supported by IDL also supported by D? What do you do with the unique and ref keywords for instance? -- Stijn OddesE_XYZ hotmail.com http://OddesE.cjb.net _________________________________________________ Remove _XYZ from my address when replying by mail
May 26 2002
"OddesE" <OddesE_XYZ hotmail.com> wrote in message news:acqivc$a3j$1 digitaldaemon.com...Walter is there still any need for IDL in D, or are all constructs supported by IDL also supported by D? What do you do with the unique and ref keywords for instance?I don't remember what those keywords do.
Jun 05 2002
simply: - unique says there is no aliasing elsewhere (in the walkable tree of arguments in "this" function call) of the ptr so marked. - ref incorporates unique, and states that the ptr so marked cannot be NULL (or rather that it will not be NULL - it's still possible to pass NULL in C/C++ of course) As I said, this is a simple explanation, but captures the most interesting features. If anyone wants to provide a fullsome explanation, be my guest ... "Walter" <walter digitalmars.com> wrote in message news:adlhnj$166m$1 digitaldaemon.com..."OddesE" <OddesE_XYZ hotmail.com> wrote in message news:acqivc$a3j$1 digitaldaemon.com...Walter is there still any need for IDL in D, or are all constructs supported by IDL also supported by D? What do you do with the unique and ref keywords for instance?I don't remember what those keywords do.
Jun 05 2002
"Matthew Wilson" <mwilson nextgengaming.com> wrote in message news:adm69r$1pt3$1 digitaldaemon.com...simply: - unique says there is no aliasing elsewhere (in the walkable tree of arguments in "this" function call) of the ptr so marked. - ref incorporates unique, and states that the ptr so marked cannot beNULL(or rather that it will not be NULL - it's still possible to pass NULL in C/C++ of course) As I said, this is a simple explanation, but captures the most interesting features. If anyone wants to provide a fullsome explanation, be my guest..."Walter" <walter digitalmars.com> wrote in message news:adlhnj$166m$1 digitaldaemon.com...Basically they aid COM in the decision for marshaling code to use. Let's say you pass a circular linked list. Since you cannot pass pointers across boundaries you will have to copy the block of memory each pointer is pointing at. However you might get in an infinite loop when passing a circular linked list, so you have to check each pointer to see if you already passed it before. Using unique tells the IDL compiler that every pointer will be unique, so the extra checking code is not needed, making the marshaling faster. -- Stijn OddesE_XYZ hotmail.com http://OddesE.cjb.net _________________________________________________ Remove _XYZ from my address when replying by mail"OddesE" <OddesE_XYZ hotmail.com> wrote in message news:acqivc$a3j$1 digitaldaemon.com...Walter is there still any need for IDL in D, or are all constructs supported by IDL also supported by D? What do you do with the unique and ref keywords for instance?I don't remember what those keywords do.
Jun 09 2002
Thanks for the illumination. D doesn't have something directly comparable. "OddesE" <OddesE_XYZ hotmail.com> wrote in message news:ae0enc$nhq$1 digitaldaemon.com..."Matthew Wilson" <mwilson nextgengaming.com> wrote in message news:adm69r$1pt3$1 digitaldaemon.com...insimply: - unique says there is no aliasing elsewhere (in the walkable tree of arguments in "this" function call) of the ptr so marked. - ref incorporates unique, and states that the ptr so marked cannot beNULL(or rather that it will not be NULL - it's still possible to pass NULLinterestingC/C++ of course) As I said, this is a simple explanation, but captures the mostfeatures. If anyone wants to provide a fullsome explanation, be my guest..."Walter" <walter digitalmars.com> wrote in message news:adlhnj$166m$1 digitaldaemon.com...Basically they aid COM in the decision for marshaling code to use. Let's say you pass a circular linked list. Since you cannot pass pointers across boundaries you will have to copy the block of memory each pointer is pointing at. However you might get in an infinite loop when passing a circular linked list, so you have to check each pointer to see if you already passed it before. Using unique tells the IDL compiler that every pointer will be unique, so the extra checking code is not needed, making the marshaling faster. -- Stijn OddesE_XYZ hotmail.com http://OddesE.cjb.net _________________________________________________ Remove _XYZ from my address when replying by mail"OddesE" <OddesE_XYZ hotmail.com> wrote in message news:acqivc$a3j$1 digitaldaemon.com...Walter is there still any need for IDL in D, or are all constructs supported by IDL also supported by D? What do you do with the unique and ref keywords for instance?I don't remember what those keywords do.
Jun 09 2002
"Walter" <walter digitalmars.com> wrote in message news:ae0vvr$18iq$1 digitaldaemon.com..."OddesE" <OddesE_XYZ hotmail.com> wrote in message news:ae0enc$nhq$1 digitaldaemon.com...guest"Matthew Wilson" <mwilson nextgengaming.com> wrote in message news:adm69r$1pt3$1 digitaldaemon.com...insimply: - unique says there is no aliasing elsewhere (in the walkable tree of arguments in "this" function call) of the ptr so marked. - ref incorporates unique, and states that the ptr so marked cannot beNULL(or rather that it will not be NULL - it's still possible to pass NULLinterestingC/C++ of course) As I said, this is a simple explanation, but captures the mostfeatures. If anyone wants to provide a fullsome explanation, be my..."Walter" <walter digitalmars.com> wrote in message news:adlhnj$166m$1 digitaldaemon.com...Basically they aid COM in the decision for marshaling code to use. Let's say you pass a circular linked list. Since you cannot pass pointers across boundaries you will have to copy the block of memory each pointer is pointing at. However you might get in an infinite loop when passing a circular linked list, so you have to check each pointer to see if you already passed it before. Using unique tells the IDL compiler that every pointer will be unique, so the extra checking code is not needed, making the marshaling faster. -- Stijn OddesE_XYZ hotmail.com http://OddesE.cjb.net _________________________________________________ Remove _XYZ from my address when replying by mail"OddesE" <OddesE_XYZ hotmail.com> wrote in message news:acqivc$a3j$1 digitaldaemon.com...Walter is there still any need for IDL in D, or are all constructs supported by IDL also supported by D? What do you do with the unique and ref keywords for instance?I don't remember what those keywords do.Thanks for the illumination. D doesn't have something directly comparable.And that makes perfect sense, COM is proprietary, D isn't. But just don't write off IDL yet... :) -- Stijn OddesE_XYZ hotmail.com http://OddesE.cjb.net _________________________________________________ Remove _XYZ from my address when replying by mail
Jun 11 2002