digitalmars.D.learn - Static on free functions
- Dave P. (13/13) Dec 07 2020 Does `static` on a free function definition do anything?
- Adam D. Ruppe (5/12) Dec 07 2020 Nope, D allows a lot of useless attributes so it doesn't complain
- Dave P. (2/16) Dec 07 2020 Thanks for the answer!
Does `static` on a free function definition do anything? I know the meaning of it in C, but I can’t find an equivalent definition (or any definition of it at all) when applied to free functions in the spec. Are the two below any different or is it just for ease of porting from C? static int foo(){ return 3; } int foo(){ return 3; }
Dec 07 2020
On Monday, 7 December 2020 at 17:01:45 UTC, Dave P. wrote:Does `static` on a free function definition do anything?Nope, D allows a lot of useless attributes so it doesn't complain if you do certain things out of habit (or it is just a lazy implementation, I'm not sure which explanation applies here)static int foo(){ return 3; } int foo(){ return 3; }but both the same.
Dec 07 2020
On Monday, 7 December 2020 at 17:07:20 UTC, Adam D. Ruppe wrote:On Monday, 7 December 2020 at 17:01:45 UTC, Dave P. wrote:Thanks for the answer!Does `static` on a free function definition do anything?Nope, D allows a lot of useless attributes so it doesn't complain if you do certain things out of habit (or it is just a lazy implementation, I'm not sure which explanation applies here)static int foo(){ return 3; } int foo(){ return 3; }but both the same.
Dec 07 2020