Why did he have to set programming back by 20 years?

Why did he have to set programming back by 20 years?

Other urls found in this thread:

doc.rust-lang.org/std/macro.format_args.html
cs.columbia.edu/2017/bjarne-stroustrup-awarded-2017-faraday-medal/
twitter.com/NSFWRedditImage

...

Is this a picture of Ulrich "strfry is not being removed" Drepper?

I reckon he was desperate for fame, and he figured the only way to get it within his lifetime was to piggy-back on the success of C and create a "compatible" language that could replace it.

But to be fair he didn't set programming back by 20 years, merely the programmers decided they actually want to remain 20 years in the past, cozy with all the undefined behaviors, dangling pointers and segmentation faults.

t. first year cs student

I know that if I asked you to write a variadic printf that you wouldn't be able to do it without copypasting from stackoverflow despite it being like 10 lines of C++ because it's way too hard for you. Go try it now. Prove to yourself that you're one of the casual faggots I'm calling out.

American or European Computer Science?

Form what I heard in American CS classes they teach basics of programming with python so no wonder that some people here treat C++ as some holy grail language for chosen. In eastern europe C and C++ are used to learn basics of procedural and OO programming. Every brainlet that passed first two semesters should know how to use valgrind or what is RAII, rule of three/five etc. but very few choose to continue learning it since market is Java/.NET oriented and on top of that C++ is ugly, bothersome and bloated.

Ha, most programmers have probably never heard of valgrind. You hope for too much from idiots.

Just so that we're on the same track. The European CS is shitty, right? In my country CS is a lower education with a bad reputation that got renamed to something english so that it would sound cooler for all the young hip whippersnappers.

Depends on country and on how you define "shitty", I guess american CS is tailored more towards what market needs meanwhile many european universities seem o be stuck in 90's focusing on some technical nuances and ignoring all this brogramming stuff needed for ~90% of nowadays mid-level IT jobs.

academia should serve mankind not corporations

He is the reason we have Rust now. I like him.

As fair as I know, in Germany, Italy and UK, Computer Science is a pretty serious course.
As says, in Europe it's more traditional meaning that it focuses on creating scientists, more than pajeet code-monkeys, translating this into a shitton of math.

youre full of shit you dumb slavfag

C++ as a whole is extremely ugly and inconsistent tbh, Java as a language doesn't come close and .NET is not even a language.

C++ is amazing and I want to make love to Bjarne and kiss his sexy bald head.

Because Dennis Ritchie set programming back 50 years.

Why did you have to be such a massive faggot?

Not him, but wouldn't this be like argc and argv[]? Sorry, I'm new, but that's the way I would do it. Or does it have to explicitly accept any amount of arguments? Please teach me, senpai.

Just popped by so you could check 'em.

Week dubs game, famalam.

...

If a country needs a certain talent they should really strive to educate their people. But in this greedy society nobody makes any 'changes' unless they or someone else benefits monetarily.

They should all be killed and tossed in the fire with their families. I want to blame capitalism, but I don't know to what extent. We as humans are very flawed so it seems impossible to live up to our capitalistic ideals> not very 'edumucated'.

If another country with an emerging economy and less normies offered me free education and a place to live for my services I would do it in a heartbeat.

But I suppose getting help with mental health is a deal breaker before anything else.. Fuck the world. I'm probably just going to end up like the brilliant Terry A. David without the intelligence or rich legacy, and eventually die as a nobody and probably alone. Cheers.

Not the fag you're responding to, but here's how you could do it:
C-style (not type-safe):void printf(const char* fmtstr, ...){ va_list args; va_start(args, fmtstr); //print fmtstr and call va_arg(args, T) with the type T of the current argument va_end(args);}
C++-style (type-safe):
void printf(const char* fmtstr){ //print what's left of fmtstr}templatevoid printf(const char* fmtstr, Arg arg, Rest... rest){ //print part of (and advance) fmtstr, print arg printf(fmtstr, rest...);}

The C++ version is pretty disgusting, isn't it? Not only do you overload a function template, but you also call it (fuck knows which one) recursively. But I imagine the compiler is smart enough to inline all those pesky function calls into a beautiful pearl of performance and efficiency.

Also, can someone explain to me what type-safe actually means? I used to think it's fancy jargon for "I need the compiler to prevent me from fucking up by using the incorrect type for a given data" but I may be wrong.

like this: doc.rust-lang.org/std/macro.format_args.html
the format string is parsed and validated at compile.

Actually, no. I use this example when teaching our devs a healthy fear of templates. It's fundamentally hard for a compiler to understand where you're going with template recursion and the design of templates prevents you from guiding the compiler, so it turns what looks very simple and clean into pure horror.
Even if you try to inline it in hopes it boils away at compile, each compiler has a different threshold with template recursion depth and it will start ignoring the inlining. If you make a test case with a bunch of calls to it with a random number of arguments from 1-20 and random types, instead of boiling away you'll get a disgustingly bloated binary full of duplicate functions depending on compiler. Even if you get lucky and that doesn't happen, you're 100% into undefined behavior territory.
The only way to fix it is to use non-standard compiler hacks to force inlining.
For more complicated templates, it gets hopeless quickly. It's why template meta-programming is still banned at every serious company and always will be. We need an alternative to templates where the compiler and programmer cooperate.

Here it means that the compiler will indeed prevent you from fucking up by using the incorrect type for a given data, whether you need it or not.


Alright, here's a C++17 version with absolutely no template recursion:templatevoid printf(const char* fmtstr, Args... args){ const auto print_non_arg = [&]{ //print and advance fmtstr until a conversion specifier is reached }; const auto print_arg = [&](auto arg){ //print arg }; ((print_non_arg(), print_arg(args)), ...); print_non_arg();}

Just to add, this can also be done in C++11 by using a global (overloaded) function for print_arg and replacing the fold expression with something like (void)std::initializer_list{(print_non_arg(), print_arg(args, fmtstr), 0)...};

Wouldn't these still either create a huge number of functions, or if inlined, a huge amount of bloat compared to C printf?

*pokes thread to fix hatechan eating posts*

You could reduce the number of functions by defining print_arg and print_non_arg as global functions. However, some bloat is unavoidable if it's called repeatedly with a huge number of arguments with different types each time.
Execution time could possibly be faster since you don't need a switch/if-else statement to get the argument types from the format string. Type safety is absolutely better (C printf has none whatsoever). As a bonus, the C++ version (with print_arg as a global function) would also be easier to extend (just overload print_arg).

Not really sounding like there's much point to C++ when it's going to be more bloated and might not be any faster than C. So the meme about this language is right, then.

Modern compilers do typecheck it.

foo.c:4:24: warning: format '%d' expects argument of type 'int', but argument 2 has type 'double' [-Wformat=]

C++ has a lot of useful features even if you just want to write c like code. Classes for example have no overhead. They compile to exactly the same code as structures and functions that that take pointer to a structure as first argument. I very much dislike this stupid approach anons showed you here, the C printf is much better, but I understand why it exist. Imagine you're working on a big project and you have 1000s of people working on it. They are willing to have some bloat but be completely sure that this thing won't break or crash, they can't afford any errors. I'm a c++ programmer at work and we use all these very safe, but slower methods, but at home when I write my own stuff I write everything in C like c++. I like knowing how my code is translated to the assembly, I actually learned assembly, them c and c++ so it's natural for me. I have no cs degree, self thought (I was revere engineering games as a kid making cheats and such). All my friends at work have cs degree or are working on it and have similar opinions of people on tech (c/c++ is so bad, fuck preprocessor, rust is better)... I think the university makes you brain rot.

And you can make all warnings errors. But you will crash when you pass 0 to %s so it's haram to use it man!! You need checks every second assembly instruction or it's unsafe.

C and C++ make your brain rot. CS solved a lot of problems before UNIX invaded.

But since
, there's at least a fair chance that it will be.
Also, does "the meme about this language" address the extensibility part?

Why can't I go back 20 years and prevent your birth?

Java and C# are pajeet-tier but you can make them relatively comfortable. C++ is just the abyss. Coding in C++ does irreparable damage to your brain.

The point was that strstr, more than any other individual, promoted this retarded idea of making anything and everything into a class. If he'd just kept C++ as "a better C" (i.e., C with a better standard library, nice features like destructuring and operator overloading, and a real macro system), it would have been the best general systems programming language of all time. Only recently have we been freed from class-tyranny with the creation of modern statically-typed, procedural languages like Rust, Nim, and I guess Go.

You don't need to use classes to use C++. That's just your lack of experience with the language.

It's worse than a language and good luck getting a job without being able to at least fake competency in it.

The most retarded thing in all of Rust. How is one supposed to internationalize that?

Yeah, I can also speak English without using contractions, but I still have to deal with them if everyone else uses them. Using classes is idiomatic in Sepples and OOP for everything is promoted by Strstr himself.

Either you are not using virtual destructors or you don't know about the pointer to the vtable that is added. C++ requires a person read a few 1000 page books and the language reference. You have to understand undefined behavior even for things like the modulus operator, and understand behavior between versions. Also compiler differences and differences between platforms.

The only valid languages are C and Scheme, and our entire tech world would be much better if this was a reality.

Pretty sure he was referring to plain old ordinary classes, here. Not sure how you could infer that the guy doesn't know about pointers to vtables.

why?

What the fuck is this shit? You're only printing the unformatted format string there at the end, there's no formatting going on here. Are you high?
#include #include // makes abs () unnecessary.const char digits[] = "ZYXWVUTSRQPONMLKJIHGFEDBCA9876543210123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";#define print_templ(name, type) \ int print_##name (type val, int base) { \ int neg = (int < 0); \ char *buf[21]; \ char *ptr = buf+20; \ if (base < 2 || base > 36) { \ return -1; \ } \ *ptr-- = '\0'; \ while (val > 0) { \ *ptr-- = digits[35 + val % base]; \ val /= base; \ } \ if (neg) putchar ('-'); \ puts (ptr); \ return strlen (ptr); \ }print_templ(uint, uintmax_t);print_templ(int, intmax_t);int printf (const char *fmt, ...) { va_list *ap; va_start(ap, fmt); int c = 0, tc, lo; const char *snf, *sdp, *cur = fmt, ts; start: tc = 0; lo = 0; // skip double percents and non-formats for (snf = cur; *snf != '%' && *snf; snf++); c += snf-fmt; cur = snf; for (sdp = snf; *sdp && sdp[0] == '%' && sdp[1] == '%'; sdp += 2, putchar ('%')); c += sdp-snf; cur = sdp; if (*cur != '%' || cur[1] == '%') goto start; if (!*cur) return c; fmtp: switch (cur[1]) { case 'c': tc = 1; putchar (va_arg(ap, /* char promotes to */int)); break; case 'd': if (lo) tc = print_int (va_arg(ap, int), 10); else tc = print_int (va_arg(ap, long long int), 10); if (tc < 0) return tc; break; case 'l': lo = 1; cur++; goto fmtp; case 'u': if (lo) tc = print_uint (va_arg(ap, unsigned int), 10); else tc = print_uint (va_arg(ap, unsigned long long int), 10); if (tc < 0) return tc; break; case 's': ts = va_arg(ap, const char *); tc = strlen (ts); puts (ts); break; case 'x': if (lo) tc = print_uint (va_arg(ap, unsigned int), 16); else tc = print_uint (va_arg(ap, unsigned long long int), 16); if (tc < 0) return tc; break; } c += tc; goto start; return c;}
This isn't the best code ever but at least it fucking does something.

It is like you are tripping over yourself to agree with me.

cs.columbia.edu/2017/bjarne-stroustrup-awarded-2017-faraday-medal/

For significant contributions to the history of computing, in particular pioneering the C++ programming language, Bjarne Stroustrup has been named the recipient of the 2017 Faraday Medal, the most prestigious award to an individual made by the Institution of Engineering and Technology.

Since 1922, this bronze medal, named after Michael Faraday, has recognized those who have made notable scientific or industrial achievements in engineering or rendered conspicuous service to the advancement of science, engineering, and technology. Previous recipients include Donald Knuth (2011), Roger Needham (1998), Sir Maurice Wilkes (1981), J A Ratcliffe (1966), Sir Edward Victor Appleton (1946), and Sir Ernest Rutherford (1930).

“I am honored and humbled to see my name among so many illustrious previous winners of the prize,” said Stroustrup. “This privilege is only possible through the superb work of the C++ community.”

Stroustrup began developing C++ in 1978 while working at Bell Labs. Strongly influenced by the object-oriented model of the SIMULA language (created by Ole-Johan Dahl and Kristen Nygaard), he extended the traditional C language by adding object-oriented programming and other capabilities. In 1985, C++ was commercially released and spread rapidly, becoming the dominant object-oriented programming language in the 1990s and one of the most popular languages, significantly impacting computing practices and pushing object-oriented technology into the mainstream of computing.

Currently Stroustrup is a Visiting Professor in Computer Science at Columbia University and a Managing Director in the technology division of Morgan Stanley in New York City. His publications include several books—The C++ Programming Language (Fourth Edition, 2013), A Tour of C++ (2013), Programming: Principles and Practice using C++ (2014)—as well as a long list of academic and general-interest publications that Stroustrup maintains here.

Recently elected an Honorary Fellow of Churchill College, Cambridge, Stroustrup is a member of the National Academy of Engineering and a Fellow of both the IEEE and the ACM. He is also a Fellow of the Computer History Museum.

Stroustrup continues to update and add functionality to C++. Even as new languages have been created for the rapidly shifting programming landscape, C++ is more widely used than ever, particularly in large-scale and infrastructure applications such telecommunications, banking, and embedded systems.

Stroustrup will receive the award in a ceremony to be held in London November 15.

I knew these were scams after they started giving people medals for things other people already invented. Stick it next to Obama's Nobel Peace Prize.