[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Why is it bad to use "C style" in C++? Like the c standard

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 11
Thread images: 2

File: line.jpg (67KB, 800x600px) Image search: [Google]
line.jpg
67KB, 800x600px
Why is it bad to use "C style" in C++? Like the c standard library functions, char arrays instead of strings, malloc instead of new keyword etc?
>>
File: tfw.jpg (50KB, 446x522px) Image search: [Google]
tfw.jpg
50KB, 446x522px
blame GNU.
>>
>>55194996

If you want to use the C code style just fucking code in C you idiot.
>>
>>55195240
Then why bother having it included in the language at all?
>>
>>55196030
C++ isn't really a language all its own; it was an extension for C that grew into what it is today.
>why is it bad to use "C style in C++
Because it is. In every way. Less efficient, more effort, you're reinventing the wheel, etc. It's just a bad idea.
>>
>>55196030
because c++ is built on top of c
>>
Because C++ is full of bloat, malloc is faster than new, char array is faster than string etc, but sometimes that one C++ feature is just too useful to skip.
>>
>>55196097
So, again, why is using the base part of the language necessarily bad?
>>
>>55196252
because then you'd be writing c code with a c++ wrapper.
it's the same reason as why you _usually_ don't write assembler code in a c program (there are some reasons to do i though).
also, some compiler checks and probably runtime checks wouldn't work.
>>
>>55196392
C++ wrapper? What are you talking about? All C keywords are still a part of C++. Unless you're using some garbage compiler with no support, I'm not sure what kind of problems you're going to run into here. Can you give me an example?
>>
>>55196481
c++ has some kind of type safety, while c almost doesn't know what datatypes even are.
for c++ you have to cast malloc while you never should in c

for what reason would you want to write c code in c++ ? why not just c ?
Thread posts: 11
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.