digitalmars.D.learn - Function pointer array slice?
- Tofu Ninja (7/7) Jul 11 2015 So simple syntax question, how do I make an array slice of
- tcak (2/9) Jul 11 2015 Alias is the correct way IMO.
- ketmar (4/18) Jul 11 2015 yet
- Tofu Ninja (8/26) Jul 11 2015 Ahh, guess that makes sense, I kept trying to put the [] over
- ketmar (6/20) Jul 11 2015 attributes are the parts of the type. and the rule is really simple: put...
So simple syntax question, how do I make an array slice of function pointers? I just have no idea where to put the [] on something like void function() nothrow pure nogc safe arrayName; Or should I just alias it and make an array of the alias? alias f = void function() nothrow pure nogc safe; f[] arrayName;
Jul 11 2015
On Saturday, 11 July 2015 at 09:30:43 UTC, Tofu Ninja wrote:So simple syntax question, how do I make an array slice of function pointers? I just have no idea where to put the [] on something like void function() nothrow pure nogc safe arrayName; Or should I just alias it and make an array of the alias? alias f = void function() nothrow pure nogc safe; f[] arrayName;Alias is the correct way IMO.
Jul 11 2015
On Sat, 11 Jul 2015 09:54:40 +0000, tcak wrote:On Saturday, 11 July 2015 at 09:30:43 UTC, Tofu Ninja wrote:yet void function() nothrow pure nogc safe [2]arrayName; is perfectly fine too.=So simple syntax question, how do I make an array slice of function pointers? I just have no idea where to put the [] on something like void function() nothrow pure nogc safe arrayName; Or should I just alias it and make an array of the alias? alias f =3D void function() nothrow pure nogc safe; f[] arrayName;=20 Alias is the correct way IMO.
Jul 11 2015
On Saturday, 11 July 2015 at 10:54:45 UTC, ketmar wrote:On Sat, 11 Jul 2015 09:54:40 +0000, tcak wrote:Ahh, guess that makes sense, I kept trying to put the [] over near function()... looks weird as hell though. I really wish you could put types in parens, I feel like things like this would make way more sense if you could write (void function() nothrow pure nogc safe)[] arrayName; Reading it, that makes wayyy more sense to me, to bad I can't write this...On Saturday, 11 July 2015 at 09:30:43 UTC, Tofu Ninja wrote:yet void function() nothrow pure nogc safe [2]arrayName; is perfectly fine too.So simple syntax question, how do I make an array slice of function pointers? I just have no idea where to put the [] on something like void function() nothrow pure nogc safe arrayName; Or should I just alias it and make an array of the alias? alias f = void function() nothrow pure nogc safe; f[] arrayName;Alias is the correct way IMO.
Jul 11 2015
On Sat, 11 Jul 2015 11:37:03 +0000, Tofu Ninja wrote:attributes are the parts of the type. and the rule is really simple: put=20 "[]" array declaration immediately left of the array name. ;-)void function() nothrow pure nogc safe [2]arrayName; is perfectly fine too.=20 Ahh, guess that makes sense, I kept trying to put the [] over near function()...looks weird as hell though. I really wish you could put types in parens, I feel like things like this would make way more sense if you could write =20 (void function() nothrow pure nogc safe)[] arrayName; =20 Reading it, that makes wayyy more sense to me, to bad I can't write this...i agree, this is somewhat easier to read. but it requires grammar=20 changes, i believe, and dunno what consequences that may have. yet it may=20 worth filling a ER.=
Jul 11 2015