Writing const-correct code in D
Kevin Bealer
Kevin_member at pathlink.com
Wed Mar 8 13:56:55 PST 2006
In article <duluq5$11ki$1 at digitaldaemon.com>, Kevin Bealer says...
>
>Also, this is not full "C++ const", only parameter passing and const
>methods, which seems to be the most popular parts of the const idea.
>It seems like it should require more syntax that C++, but it only
>takes a small amount.
>
>
>When working with types like "int", use "in" - const is not too much
>of an issue here.
>
>The same is true for struct, it gets copied in, which is fine for
>small structs. For larger structs, you might want to pass by "in *",
>i.e. use "in Foo *". You can modify this technique to use struct, for
>that see the last item in the numbered list at the end.
>
>
>For classes, the issue is that the pointer will not be modified with
>the "in" convention, but the values in the class may be.
>
> // "Problem" code
Oops .. this seems to have been cut off.. apparently a single "." causes this
reader to destroy email. I'll post the other 80% of the post again tonight.
Kevin
More information about the Digitalmars-d
mailing list