returning different types via function
Jesse Phillips
Jesse.K.Phillips+D at gmail.com
Tue Nov 19 13:06:40 PST 2013
On Tuesday, 19 November 2013 at 19:15:10 UTC, seany wrote:
> (so i want liek a C style fopen -like function, that , although
> called with the syntax: file *f = fopen(balh, "bla"); can set f
> to be false)
I think you have a misunderstanding here. C does not allow you to
return "false." Instead C states that 0/NULL is false. Similarly
D also considers null and 0 to be false inside a conditional
(where in D's case those are two different values).
So yes, you can do the same in D, but since false, null, and 0
are actually all different types and will not implicitly cast to
the other.
More information about the Digitalmars-d-learn
mailing list