www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - calling function withouth ()

reply "Ivan Senji" <ivan.senji public.srce.hr> writes:
<CODE>
import std.stdio;

int func()
{
 writefln("HAHA");
 return 0;
}

void main ()
{
 func;
 getch();
}
</CODE>

The function isn't actually called but this compiles and runs
but doesn't call func();
Jul 25 2004
parent reply "Ivan Senji" <ivan.senji public.srce.hr> writes:
Funny: :)

This calles the function:

<CODE>
import std.stdio;

int func()
{
 writefln("HAHA");
 return 0;
}

void main ()
{
 func + 0;
 getch();
}
</CODE>

Also for example this works:

-func; //calls the function.


So! We have partial global properties in D? :)


"Ivan Senji" <ivan.senji public.srce.hr> wrote in message
news:ce10fg$2jja$1 digitaldaemon.com...
 <CODE>
 import std.stdio;

 int func()
 {
  writefln("HAHA");
  return 0;
 }

 void main ()
 {
  func;
  getch();
 }
 </CODE>

 The function isn't actually called but this compiles and runs
 but doesn't call func();
Jul 25 2004
next sibling parent "Vathix" <vathixSpamFix dprogramming.com> writes:
"Ivan Senji" <ivan.senji public.srce.hr> wrote in message
news:ce10l5$2jol$1 digitaldaemon.com...
 Funny: :)

 This calles the function:

 <CODE>
 import std.stdio;

 int func()
 {
  writefln("HAHA");
  return 0;
 }

 void main ()
 {
  func + 0;
  getch();
 }
 </CODE>

 Also for example this works:

 -func; //calls the function.


 So! We have partial global properties in D? :)
The code had to be funny to make it laugh ;) I think there should be global properties.
Jul 25 2004
prev sibling parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
!!

we DO have global properties!!

import std.c.stdio;
import std.string;

int m_x;

int x(int y) { return m_x=y; }
int x() { return m_x; }

void main()
{
 x=5;
 printf("%d\n",x);
}
Jul 25 2004
parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
sorry if my last post came across as angry or patronizing, i was happy and
forgot to put in a " :) ".  :)
Jul 25 2004