Ruby to C?

M

Mohammad ---

Okay, I'm working an a robotics project and instead of using C could I
actually write it in ruby then convert it into C code?
 
R

Ryan Davis

If you mean convert automatically, no, not really. Not unless what
you write
in Ruby is very generic, and you don't use any of C's distinct
properties.
If that were true, converting to C would have little point.

Not quite accurate. Depending on what you're doing ruby2c might work.
Given that it is a robotics program, we're generally talking fairly
boring prorgamming anyhow. It might be translatable with ruby2c,
possibly even without much work.
Why do you think you need to convert to C?

Presumably so he can download the program to the robot and ruby
doesn't run there.
For speed? I have written a
number of projects in Ruby because the development time is so
short, then,
after establishing the design, I converted to a faster language.
But the
conversion was by no means easy.

There are several much easier ways to make your ruby fast. Usually
keeping most everything ruby. Full ports are my absolute LAST option.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,218
Messages
2,571,124
Members
47,727
Latest member
smavolo

Latest Threads

Top