www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - htod - const

reply dnewbie <run3 myopera.com> writes:
I have this file tmp.h:

const char *getvalue(const char *key);

I run htod tmp.h and I've got the output

-----------------------------------
/* Converted to D from tmp.h by htod */
module tmp;
//C     const char *getvalue(const char *key);
extern (C):
char * getvalue(char *key);
-----------------------------------

Why is 'const' removed?
Mar 06 2012
next sibling parent Trass3r <un known.com> writes:
 Why is 'const' removed?

cause htod sucks. D1 didn't have const and htod wasn't updated for ages.
Mar 06 2012
prev sibling next sibling parent maarten van damme <maartenvd1994 gmail.com> writes:
--f46d0447a14d14e38f04ba97d6e3
Content-Type: text/plain; charset=ISO-8859-1

trass3r, I wouldn't say that it sucks. It has really helped a lot in
porting some simple header files. It  goes terribly bad on the more complex
though.

--f46d0447a14d14e38f04ba97d6e3
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

trass3r, I wouldn&#39;t say that it sucks. It has really helped a lot in po=
rting some simple header files. It =A0goes terribly bad on the more complex=
 though.

--f46d0447a14d14e38f04ba97d6e3--
Mar 06 2012
prev sibling next sibling parent Trass3r <un known.com> writes:
Am 06.03.2012, 20:13 Uhr, schrieb maarten van damme  
<maartenvd1994 gmail.com>:

 I wouldn't say that it sucks. It has really helped a lot in
 porting some simple header files. It  goes terribly bad on the more  
 complex though.

Sadly, using regular expressions is much more efficient. At least those don't destroy the source by removing const, comments, evaluating preprocessor directives, etc.
Mar 06 2012
prev sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 3/6/12, Trass3r <un known.com> wrote:
 Sadly, using regular expressions is much more efficient.

Do you have some script that does that and sorta works? I've tried others (e.g. dstep but couldn't get LLVM to compile unfortunately..).
Mar 06 2012