» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
 

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: C programming question< Next Oldest | Next Newest >
curaga Offline





Group: Members
Posts: 2163
Joined: Feb. 2007
Posted: Oct. 06 2007,14:25 QUOTE

I've found the use of QT and fltk UI builders very easy.
With them I can easily create professional-looking gui apps, that execute very fast, compared to Lua for example.

:) Yes, I am lazy, and since I already know Java, I think learning C will be easier than learning Lua.

Anyway, both those builders output C++ files.

Can I just mix C and C++ code in the same file? If the C code is in it's own function and C++ in it's own?

Or, would it be a better way to create the "main" function in C in it's own file, calling that gui C++ file as needed?

Or a third option, should I learn C++ instead of C?


In C I can already do a Hello World - program!


--------------
There's no such thing as life. Those mean little jocks invented it ;)
-
Windows is not a virus. A virus does something!
Back to top
Profile PM 
florian Offline





Group: Members
Posts: 66
Joined: Dec. 2006
Posted: Oct. 06 2007,17:39 QUOTE

Quote

I've found the use of QT and fltk UI builders very easy.
With them I can easily create professional-looking gui apps, that execute very fast, compared to Lua for example.

I believe the best for DSL would be nice to have murgalua compiled with fltk as a SHARED lib, so that this lib would be accessible to other light fltk c/c++ programs.

Quote

Yes, I am lazy, and since I already know Java, I think learning C will be easier than learning Lua.

Not necessarily! C/C++ has a similar overall syntax than Java. Yet, memory allocation, pointers, and c++ references might can be very tricky when coming from Java (which has garbage collection and has an implicit use of references)

Quote

Can I just mix C and C++ code in the same file?

In your case, as long as you can compile using g++, you probably can quite hapilly use a mix of c and c++ in your own code. Most of the trouble of mixing c and c++ is when using a pure c lib from c++ (then you should make sure you include everything with extern "C") or when exposing your c++ lib to c.

A very good resource if you have to deal with c++ is the the C++ FAQ Lite. Look at item 32; this is specifically about mixing C and C++
Back to top
Profile PM WEB 
curaga Offline





Group: Members
Posts: 2163
Joined: Feb. 2007
Posted: Oct. 06 2007,17:59 QUOTE

Thanks. For having fltk as a shared lib, it doesn't add many kb's even when static..

--------------
There's no such thing as life. Those mean little jocks invented it ;)
-
Windows is not a virus. A virus does something!
Back to top
Profile PM 
^thehatsrule^ Offline





Group: Members
Posts: 3275
Joined: July 2006
Posted: Oct. 06 2007,18:40 QUOTE

c++ is a superset of c... so technically if you learn c++, you'll also cover c (albeit different invocations)... but what may be missed is the approach you would take.  I'd advise just sticking with one, as it will avoid confusion.  Since you already have a Java background - which is OO, it may be easier to try c++.  However, I have not covered much of all the languages mentioned (Java, c++, c), so this is just my opinion.

As for the performance, I think lua is an interpreted language, so usually it will be slower.
Back to top
Profile PM 
roberts Offline





Group: Members
Posts: 4983
Joined: Oct. 2003
Posted: Oct. 06 2007,22:05 QUOTE

florian wrote ....
Quote
I believe the best for DSL would be nice to have murgalua compiled with fltk as a SHARED lib, so that this lib would be accessible to other light fltk c/c++ programs.


I completely agree with this statement. Other have sugguested such on the murgaLua fourms. But it will not be so according to John Murga. That was my rant of late about LuaAIO (All in One), which apparently is a similiar goal of murgaLua. But we can't always get exactly what we want, and I for one am very glad to see an updated and current Lua / Fltk binding.  

I promote Lua/Fltk for nice looking guis and to easily share the knowledge with the community. If C or C++ were used then the community would not have such easy access to the code. Which btw I am awful at keeping source and object together. GUIs don't need speed.

Use C/C++ for window managers, icon managers and other large applications. For gui front ends C/C++ are IMHO overkill.
Back to top
Profile PM WEB 
4 replies since Oct. 06 2007,14:25 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

 
reply to topic new topic new poll
Quick Reply: C programming question

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code