If you use C to do OO, you're pretty much admitting you chose the wrong tool IMO. Someone already extended C to support OO, I heard.
- Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
- Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
Is C a 'good' programming language?
Collapse
X
Collapse
-
Originally posted by MaryPoppinsI'd still not breastfeed a naziOriginally posted by vetranUrine is quite nourishing -
Originally posted by d000hg View PostIf you use C to do OO, you're pretty much admitting you chose the wrong tool IMO. Someone already extended C to support OO, I heard.
I can't understand why anybody would ever use C over C++. C++ can do everything that C can do, and there's no memory or performance overhead to any of the OO stuff where you don't use it.Will work inside IR35. Or for food.Comment
-
Originally posted by zeitghostCan you fit C++ code into 8k of rom?Will work inside IR35. Or for food.Comment
-
Originally posted by VectraMan View PostOf course you can. The runtime is the same as C.Comment
-
I'd expect C++ compilation to be bigger by default, but that you can fiddle with settings to get around it.
But as soon as you use C++ features you add in extra stuff I suppose.
Embedded is one case where C is the best choice... in many cases I think it's the only choice though as nobody has written a C++ compiler.Originally posted by MaryPoppinsI'd still not breastfeed a naziOriginally posted by vetranUrine is quite nourishingComment
-
I didn't realise C required a runtime. Doesn't the C compiler provide options to output nothing but (non-portable) native code, sans a monster runtime?Comment
-
Originally posted by DimPrawn View PostI thought the runtime for C++ was bigger as it uses the C runtime but adds to it?
OOP won't add any extra stuff to the standard library, or to the size of the code for that matter, except where you use extra stuff. A virtual function has an overhead, but if you don't use them it won't matter and if you do use them the overhead would be much the same as implementing the same in C. Data hiding and non-virtual members are done by the compiler, nothing to do with the output.
There's no downside to C++ that I see, so you may as well write your C code the same but using the C++ compiler and have the benefit of being able to use OOP features.Will work inside IR35. Or for food.Comment
-
Interesting thread. Embedded systems programming has been mentioned a few times and I'll chime in and agree that C definitely has its place in this field. My background is electronics hardware and from that I moved into using assembler and C for PICs and ARM processors. I suppose on limited embedded platforms like these, "assembler with tits on" is exactly what you want from a programming language, and nothing more! I'm used to the concept of managing memory resources yourself and selecting the libraries to match the processor variant and peripherals you're using. I enjoy using C, and don't believe that lack of OOP features make it 'bad'.Comment
-
Originally posted by zeitghostAll the C compilers I've used produce machine code (eventually)...
However, including printf is usually fatal, immediately using all the code space for the library support...Comment
-
Originally posted by zeitghostIndeed... and squirt the debugging stuff out of the nearest available serial port, if any...
Ah.
Dear dead days beyond recall...
FFS!Comment
- Home
- News & Features
- First Timers
- IR35 / S660 / BN66
- Employee Benefit Trusts
- Agency Workers Regulations
- MSC Legislation
- Limited Companies
- Dividends
- Umbrella Company
- VAT / Flat Rate VAT
- Job News & Guides
- Money News & Guides
- Guide to Contracts
- Successful Contracting
- Contracting Overseas
- Contractor Calculators
- MVL
- Contractor Expenses
Advertisers
Contractor Services
CUK News
- How much tax to pay HMRC on cryptocurrency? Today 10:00
- Life Insurance services Yesterday 10:21
- Relevant Life Insurance Services Yesterday 10:08
- Will umbrella company regulation spark mergers and acquisitions? Yesterday 09:24
- Critical Illness Insurance for Contractors: Protect Yourself When It Matters Most Jan 14 16:26
- Relevant Life Insurance for Contractors with a Limited Company Jan 14 16:14
- Life Insurance for Contractors: Why it’s Essential Jan 14 16:09
- Guide to Income Protection Insurance for Contractors Jan 14 16:00
- Treasury minister told six actions can save contractor umbrella sector from ‘existential’ crisis Jan 14 09:40
- Critical Illness Services Jan 13 16:41
Comment