Thread overview | ||||||
---|---|---|---|---|---|---|
|
June 03, 2004 Cast syntax | ||||
---|---|---|---|---|
| ||||
I just noticed that the C-style cast syntax has been deprecated (was trying to compile DUI when I discovered it.) One question though... what is the merit in replacing one hard to read cast syntax with another, equally hard to read and on top of all unfamiliar, syntax? That is, what does this: cast(char *)(p + 2) Do for me over this: (char *) (p + 2) ? In my opinion, a cast method is fine, but it would be far simpler to read and write if it looked like this instead: cast(char *, p + 2) I'm not sure why it wasn't done this way or even if it's feasible to do it that way, but I'm also not sure why you wouldn't fix the syntax properly if you're going to change it at all. :-) (I apologise if this has been brought up before but I didn't see the word 'cast' anywhere in the message listings so I thought it might be safe to bring up.) |
June 03, 2004 Re: Cast syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to trejkaz | <trejkaz@xaoza.net> escribió en el mensaje news:c9luks$ocj$1@digitaldaemon.com | I just noticed that the C-style cast syntax has been deprecated (was trying to | compile DUI when I discovered it.) | | One question though... what is the merit in replacing one hard to read cast | syntax with another, equally hard to read and on top of all unfamiliar, syntax? | That is, what does this: | | cast(char *)(p + 2) | | Do for me over this: | | (char *) (p + 2) | | ? Parsing is easier. | | In my opinion, a cast method is fine, but it would be far simpler to read and | write if it looked like this instead: | | cast(char *, p + 2) That's understable, yes. But if you see this: cast(a,b); How do you know if it's b->a or a->b? | | I'm not sure why it wasn't done this way or even if it's feasible to do it that | way, but I'm also not sure why you wouldn't fix the syntax properly if you're | going to change it at all. :-) | | (I apologise if this has been brought up before but I didn't see the word 'cast' | anywhere in the message listings so I thought it might be safe to bring up.) ----------------------- Carlos Santander Bernal |
June 05, 2004 Re: Cast syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to trejkaz | You're posting on the wrong newsgroup. This one's been retired. But the answer is that you can grep for cast with ease. It's pretty hard to grep for casts in and amongst all the other braces. <trejkaz@xaoza.net> wrote in message news:c9luks$ocj$1@digitaldaemon.com... > I just noticed that the C-style cast syntax has been deprecated (was trying to compile DUI when I discovered it.) > > One question though... what is the merit in replacing one hard to read cast syntax with another, equally hard to read and on top of all unfamiliar, syntax? That is, what does this: > > cast(char *)(p + 2) > > Do for me over this: > > (char *) (p + 2) > > ? > > In my opinion, a cast method is fine, but it would be far simpler to read and write if it looked like this instead: > > cast(char *, p + 2) > > I'm not sure why it wasn't done this way or even if it's feasible to do it that way, but I'm also not sure why you wouldn't fix the syntax properly if you're going to change it at all. :-) > > (I apologise if this has been brought up before but I didn't see the word 'cast' > anywhere in the message listings so I thought it might be safe to bring up.) > > |
June 07, 2004 Re: Cast syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | In article <c9odo9$1bkp$2@digitaldaemon.com>, Carlos Santander B. says... > Parsing is easier. Well... I guess... >| In my opinion, a cast method is fine, but it would be far simpler to read >| and write if it looked like this instead: >| >| cast(char *, p + 2) > >That's understable, yes. But if you see this: > >cast(a,b); > >How do you know if it's b->a or a->b? The same way that you know which one it is when you write cast()()! TX |
Copyright © 1999-2021 by the D Language Foundation