Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ C to C++

C to C++

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by BluePanther   United Kingdom  (8 posts)  Bio
Date Sun 07 Jun 2015 09:55 AM (UTC)
Message
So far I've:
Installed build essentials
Forked a Git repository
Git cloned it
Compiled it - failed: no zlib
Installed zlib
Compiled it - success
Started it - failed: wrong shell scripting language, should be bash
Amended startup - crash course in bash and csh!
Start it - success
Mushclient connect to it as Admin - success
In a room, no exits. What? Perhaps I need to search? Nope
Wheres the friendly admin manual? No, there isn't one.
Search Gammon Forum - loads of commands: goto <vnum>
Just need vnum of areas - found
Goto areas - woo hoo!

Now what?
I know: I'll convert it very, very slowly to C++, because although have dabbled with C I've no experience of C++, so I'll get to learn the language!

Renamed .? to .?pp
Amended Makefile - something else to crash learn, sigh
Compiled it again - success
Start it - success
Mushclient connect to it as Admin - success

Now I want to change standard .h (eg stdio.h) to C++ equivalents (drop the .h affix a c), but for those .h without a C++ equivalent I need to surround it with extern "C" { ... }.

So my question is, are the .h required for telnet already C++ compliant or do I need to wrap them? If they are please let me know what gives it away so that I can check zlib myself without hassling you.

Thank you in advance.
Top

Posted by BluePanther   United Kingdom  (8 posts)  Bio
Date Reply #1 on Sun 07 Jun 2015 12:19 PM (UTC)
Message
Update:

Installed zlib.h has the extern "C" { ... } wrapping when compiled using C++ - nice

Anyone got any information about the telnet headers?
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #2 on Sun 07 Jun 2015 09:43 PM (UTC)

Amended on Sun 07 Jun 2015 09:44 PM (UTC) by Nick Gammon

Message
Try it and see, is my advice. Quite possibly they have it in them.

Quote:

Now I want to change standard .h (eg stdio.h) to C++ equivalents ...


This will be a big job. I'm not saying it can't be done, but a lot of work for fairly little return. You can always convert the files to .cpp and still use the standard IO.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Fiendish   USA  (2,534 posts)  Bio   Global Moderator
Date Reply #3 on Sun 07 Jun 2015 10:51 PM (UTC)
Message
Quote:
I know: I'll convert it very, very slowly to C++, because although have dabbled with C I've no experience of C++, so I'll get to learn the language!

No you won't. C++ is almost a superset of C (not exactly, but that's another conversation). So almost all C code will compile just fine as C++ with very minor changes. So converting a large amount of working C to C++, even if you can actually get through all of it, will teach you next to nothing important about C++. Working knowledge of templates, class inheritence, constructors/destructors, etc are not things you can pick up from doing a conversion from C to C++, because they won't be necessary to get the code working because the code will work without them.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by BluePanther   United Kingdom  (8 posts)  Bio
Date Reply #4 on Mon 08 Jun 2015 11:46 AM (UTC)
Message
Quote:
Try it and see, is my advice. Quite possibly they have it in them.

I shall.

Quote:
This will be a big job. I'm not saying it can't be done, but a lot of work for fairly little return. You can always convert the files to .cpp and still use the standard IO.

I'll try it out with one of the source files and make a decision as to carry on or not.

Quote:
I know: I'll convert it very, very slowly to C++, because although have dabbled with C I've no experience of C++, so I'll get to learn the language!

Now wish I hadn't said that - so naive of me.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


15,160 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.