www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

D - forward references

↑ ↓ ← "Pavel Minayev" <evilone omen.ru> writes:
Their implementation in D seems unclear to me.
On one hand, they are allowed - at least in alpha:

    int function(int n);    // works!

On other hand, they don't serve any practical meaning -
D doesn't need them anyhow, and there is no way
to define a body once the prototype was declared:

    int function(int n) { }    // symbol conflict

So what are they for?
Dec 15 2001
↑ ↓ → "Walter" <walter digitalmars.com> writes:
"Pavel Minayev" <evilone omen.ru> wrote in message
news:9vgete$138v$1 digitaldaemon.com...
 Their implementation in D seems unclear to me.
 On one hand, they are allowed - at least in alpha:

     int function(int n);    // works!

 On other hand, they don't serve any practical meaning -
 D doesn't need them anyhow, and there is no way
 to define a body once the prototype was declared:

     int function(int n) { }    // symbol conflict

 So what are they for?

They're for if you really do want to create a library with a hidden implementation of the functions. The way to do it would be make a copy of the module, and delete the function bodies.
Dec 16 2001