www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - when should I use a function call without parenteses?

reply "AsmMan" <jckj33 gmail.com> writes:
In which context do you use a function call without paranteses? 
(considering the function doesn't has arguments or they're 
default, of couse)

I want to know when/why should I use or if it depends only to 
programmer's coding style..

f / baa.foo

versus

f() / baa.foo()

personally, to me, which came from C and C# world I find a bit 
strange use f symbol being f a function but I can get used to it 
very easily.
Sep 15 2014
parent "Adam D. Ruppe" <destructionator gmail.com> writes:
On Tuesday, 16 September 2014 at 01:11:49 UTC, AsmMan wrote:
 In which context do you use a function call without paranteses?
It is really just personal preference, people tend to leave the parens off when they just add subjective noise. A good rule though would be to leave the parens off when it is an obvious function call or if the function is cheap enough that the call doesn't matter (if it is just a thin property for example).
 I want to know when/why should I use or if it depends only to 
 programmer's coding style..
basically yeah it is just that.
Sep 15 2014