C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #16  
Old February 19th, 2003, 08:29 PM
dwise1_aol's Avatar
dwise1_aol dwise1_aol is offline
Contributing User
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jan 2003
Location: USA
Posts: 3,949 dwise1_aol User rank is Colonel (50000 - 60000 Reputation Level)dwise1_aol User rank is Colonel (50000 - 60000 Reputation Level)dwise1_aol User rank is Colonel (50000 - 60000 Reputation Level)dwise1_aol User rank is Colonel (50000 - 60000 Reputation Level)dwise1_aol User rank is Colonel (50000 - 60000 Reputation Level)dwise1_aol User rank is Colonel (50000 - 60000 Reputation Level)dwise1_aol User rank is Colonel (50000 - 60000 Reputation Level)dwise1_aol User rank is Colonel (50000 - 60000 Reputation Level)dwise1_aol User rank is Colonel (50000 - 60000 Reputation Level)dwise1_aol User rank is Colonel (50000 - 60000 Reputation Level)dwise1_aol User rank is Colonel (50000 - 60000 Reputation Level)dwise1_aol User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Month 3 Days 16 h 1 m 36 sec
Reputation Power: 523
Quote:
Originally posted by andy3109
Is C++ used in micro-controllers? or just C? If its just C then I think I am going to postpone my education in C++ until I learn C. Is this correct?

-andy


Used to be that C++ required too much memory and processoring resources for practical use in embedded programming, but now the hardware is more than adequate (386 & 486 are common and megs of ram). Although all my embedded work is still in C (creaky ol' 80188), I do see from trade journals and advertisements that C++ is being used.

Besides, when you write your test and monitor programs on the PC, you'd want it to be in C++.

Also, I've seen a number of schools drop their C classes and teach C++ from the start. Just start out thinking of it as a "better C".

Reply With Quote
  #17  
Old February 19th, 2003, 08:36 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is online now
Banned ;)
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 7,679 Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 3 Days 48 m 28 sec
Reputation Power: 1083
For a good reference, see http://www.oreilly.com/catalog/embsys/ where he talks about certain features of C++ that should be avoided (so as not to generate extra large code).

Reply With Quote
  #18  
Old February 19th, 2003, 08:39 PM
andy3109's Avatar
andy3109 andy3109 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 421 andy3109 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 h 46 m 21 sec
Reputation Power: 6
Send a message via AIM to andy3109
Do you think there will be a transition from C to C++? If I became skilled in C++ would I need to remember all new library's, commands, etc. etc. if i wanted to persue C? Thanks in advance.

-andy
__________________
hmmm...

Reply With Quote
  #19  
Old February 20th, 2003, 01:38 AM
dwise1_aol's Avatar
dwise1_aol dwise1_aol is offline
Contributing User
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jan 2003
Location: USA
Posts: 3,949 dwise1_aol User rank is Colonel (50000 - 60000 Reputation Level)dwise1_aol User rank is Colonel (50000 - 60000 Reputation Level)dwise1_aol User rank is Colonel (50000 - 60000 Reputation Level)dwise1_aol User rank is Colonel (50000 - 60000 Reputation Level)dwise1_aol User rank is Colonel (50000 - 60000 Reputation Level)dwise1_aol User rank is Colonel (50000 - 60000 Reputation Level)dwise1_aol User rank is Colonel (50000 - 60000 Reputation Level)dwise1_aol User rank is Colonel (50000 - 60000 Reputation Level)dwise1_aol User rank is Colonel (50000 - 60000 Reputation Level)dwise1_aol User rank is Colonel (50000 - 60000 Reputation Level)dwise1_aol User rank is Colonel (50000 - 60000 Reputation Level)dwise1_aol User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Month 3 Days 16 h 1 m 36 sec
Reputation Power: 523
Primarily, C++ is an extension of C. C++ can use the same library functions as C. Except for a very few things, a C program compiles under C++ with no problem at all. Incompatibilities of C to C++ are so few that I cannot even think of what they are. As you start to learn C++, you will be learning C.

The main feature of C that is normally not used in C++ is C's dynamic memory allocation/deallocation. Instead of malloc and free, C++ uses new and delete. And using the struct and enum keywords are mandatory in C whereas it is optional in C++.

No, you would have very few new things to learn when you shift from C++ back to C.

Reply With Quote
  #20  
Old March 1st, 2003, 07:29 PM
Jason Doucette's Avatar
Jason Doucette Jason Doucette is offline
jasondoucette.com
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Canada
Posts: 378 Jason Doucette User rank is Private First Class (20 - 50 Reputation Level)Jason Doucette User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 7 h 23 m 8 sec
Reputation Power: 6
Re: why would anyone use assembly rather than c?

Quote:
Originally posted by balance
speed right? does that always hold true? are there certain things that would benifit, speed wise, from assembly, and other things that would not? what sort of things?

i read a page by someone who did a basic bubblesort algorithm three times. first in c. second in optimised c. third in assemebly. i can't remember the results exactly but proportionately they were something like this:
normal c: 10
optimised c: 6
assembly lang: 7
and this was from someone who was selling the virtues of assembly. maybe he wasn't so good at assembly? who knows, but it does just make me wonder if assembly is worth it at all?
I would say this person does not know how to program in assembly very well. Then again, the bubble sort algorithm is so simple, that C code should be very close to a very optimized assembly program - so this test is meaningless. You need to use algorithms that are more complex, that are closer to real-life situations. Using inline assembly language has always sped up my programs. You need not program in 100% ASM, but learning a bit to optimize inner code that is executed a lot helps.

Another note is that most people do not realize that even the best compiler cannot optimize all code, regardless of what your university professors tell you. So, if you need more speed, you do not necessarily have to convert to ASM. Take a look at this very simple example of code that is on the inside of a loop of a graphics effect I created:

This gets 65 fps:
for(k=0; k<=2; k++)
c[k] += xinc[k];

Unrolling the loop gets 120 fps:
c[0] += xinc[0];
c[1] += xinc[1];
c[2] += xinc[2];

The compiler couldn't optimize it at all. If I converted this into ASM, I could probably use MMX instructions to execute all three additions at one time. I bet there's no compiler that would take advantage of such instructions in this case.

There are other simple examples that pop into my mind such as using a single dimension array when a 2-dimensional array seems to be required, but is not, such as storing a position in a game of chess or checkers. Just because you visualize it in 2D in your mind, it doesn't mean the computer has to access it this way.

Reply With Quote
  #21  
Old March 3rd, 2003, 04:45 PM
balance balance is offline
.
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 296 balance User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
thanks for the info.

i'm still worried that i'd spend a lot of time learning something that would only give a small benifit, if any. but from what you say it is worth it. i do have a rediculous amount of stuff to learn at the moment, so assembly isn't high priority, but still not out of the picture as it were. there is something i find quite interesting about that sort of low level/bits type stuff.

do you know of any good learning material for assembly? online or books or whatever? thanks

Reply With Quote
  #22  
Old June 29th, 2003, 12:27 PM
iGuy iGuy is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: where-abouts unknown
Posts: 4 iGuy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Re: Any experience with wxWindows?

Quote:
Originally posted by marron79
I downloaded wxWindows last week and installed it to use with my Dev-C++ complier, but I have no idea how to use it. I've searched the wxwindows.org website extensively and can't find any documentation about how to use it! The only documentation I could find was about the functions used in the library files. Has anyone used this? And how do you make programs for Macs? I'd really like to make an application for Windows and Mac, but I really don't want to have to learn three different programming languages (ie. C++, Windows API, Macintosh API) just to make a simple slideshow program. I looked for a forum on the website, but couldn't find that either. I guess there's no support for it since it's free.


marron79:

The only tools I know that will allow you to write once, an deploy on both Win/Mac platforms are Java and RealBasic.

I know that anything with 'basic' in the name sounds to simple to be worth anything; but you might find what you need. I usually use C++ on a Linux platform -- but i hav used RealBasic for precisely the reason you shoul check it out: It is a qucik, easy, but fairly powerful OOP IDE that is write once, deploy both.
URL

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > why would anyone use assembly rather than c?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT