Re:C-for-all: Extending C with modern safety and productivit...
by 0xdead on Wednesday December 04, 2019 @12:28PM
(#21704395)
> writing C++ does not automatically make your code bloated
Sorry, but it does.
Re:C-for-all: Extending C with modern safety and productivit...
by quotemstr on Wednesday December 04, 2019 @06:30PM
(#21708323)
No, it does not.
Re:C-for-all: Extending C with modern safety and productivit...
by 0xdead on Thursday December 05, 2019 @02:17PM
(#21715421)
$ cat hello.c
#include <stdio.h>
int main(void)
{
printf("hello world\n");
return 0;
}
$ cat hello.cpp
#include <iostream>
using namespace std;
int main(void)
{
cout << "hello world" << endl;
return 0;
}
$ gcc -o hello_c hello.c
$ g++ -o hello_cpp hello.cpp
$ ll hello_*
-rwxr-xr-x 1 root root 5880 Dec 5 14:13 hello_c
-rwxr-xr-x 1 root root 7424 Dec 5 14:14 hello_cpp
I see 1544 bytes of bloat. Hope that helps.
Plain C ought to be considered a legacy language and not used for new code. There is zero reason to prefer it over whatever style of C++ you'd like. If you want procedural struct-based C++, you can have that, but gosh, don't write C.