Walter Bright wrote:
> Jens Mueller wrote:
> >I'm converting a .h to a d module. I'm following the guide on
> >http://www.digitalmars.com/d/2.0/htomodule.html
> >It says
> >"D has const as a storage class, not a type modifier. Hence, just drop
> >any const used as a type modifier"
> >
> >I do not understand the first sentence nor do I find dropping the const
> >right. Why should I drop a const?
> >In TDPL const/immutable are type qualifiers. Type qualifier is a
> >synonym for type modifier, isn't it? And I know storage classes like
> >static/ref. In C you have the type qualifiers const, volatile, and
> >restrict and the storage classes auto, register, static, extern. Now
> >const in D is a storage class?
> 
> const in D1 is a storage class, in D2 it's a type modifier. The web
> page needs updating.

I'm attaching an svn diff. Can you apply it? Since one doesn't need to
care about const then maybe one should drop the complete section. What
do you think?
I find this converting tutorial quite useful. Is there anything else
missing or wrong? I'd like to adjust it because it helps people to add C
libraries to D.

Jens
Index: docsrc/htomodule.dd
===================================================================
--- docsrc/htomodule.dd	(revision 2200)
+++ docsrc/htomodule.dd	(working copy)
@@ -246,8 +246,8 @@
 
 <h4>Const Type Modifiers</h4>
 
-	D has $(TT const) as a storage class, not a type modifier. Hence, just
-	drop any $(TT const) used as a type modifier:
+	D has $(TT const) as a type modifier like C. Hence, the $(TT
+	const) type modifier should be preserved.
 
 $(CCODE
 void foo(const int *p, char *const q);
@@ -256,7 +256,7 @@
 	becomes:
 
 ---------------------------
-void foo(int* p, char* q);
+void foo(const int* p, char *const q);
 ---------------------------
 
 <h4>Extern Global C Variables</h4>

Reply via email to