Gcc

int main() { std::string s; int n = 5 / 2; std::cout

Other urls found in this thread:

en.wikipedia.org/wiki/Category:Software_using_the_NCSA_license
godbolt.org/g/AAS6CA
developer.mozilla.org/en-US/docs/Web/CSS/line-height
gmplib.org
twitter.com/NSFWRedditImage

You used it

Looks like it's the same for clang. Pretty strange, since
#include int main(void) { char *s; int n = 5 / 2; printf("%d\n", n); return 0;}
gives a unused variable ā€˜sā€™ warning. Must be because C++ is for faggots.
Truncating what to int, retard? It's an integer division.

...

What loss? Integer division is truncating the remainder by design, if you do integer division it's assumed you want the remainder to be truncated.

gcc is for commie faggots
use clang

i'll bet you it compiles it out anyway.

this

meme license that doesn't even require the source to be made available
en.wikipedia.org/wiki/Category:Software_using_the_NCSA_license

meme license is better than meme license+messy code

Did you use -Wall -Wextra?


In the words of Scott Meyers, is there a Windows package for it, faggot? An official standalone distro that doesn't require either Visual Studio or GCC to be installed? One that comes bundled with stdc++ out of the box?

It can warn you, you have to enable verbose warnings when compiling.
int round down is a great thing, considering you can always get the remainder with a %.

your shitty bait doesnt even compile
godbolt.org/g/AAS6CA

-Wall -Wextra -pedantic -O2

You can't catch bait with bait.

are you saying that im baiting? because i most assuredly am not. i just popped what op posted into godbolt and it doesnt compile.

std::string isn't unused. It has a non-trivial constructor that can throw. Welcome to C++.

Better to claim you were pretending to be retarded than just being retarded.
#include #include int main() { std::string s; int n = 5 / 2; std::cout

ok fag

Yeah, you're retarded. Just stay out of discussions you have no clue about.

ok

please tell me why op didnt just post working code???

const bool OP = faggot

Also, lurk more.

nice photoshoop fag

lol

(You)
(You)
Here are your (You)s

Why are the shittiest threads and comments when Europe is awake?

thx


because i, steve klabnik am a europoor

I don't see any truncation to int here. You're taking two integers and performing integer division on them, giving you an integer. Where's the problem?

Christ, this is why Holla Forums needs ID's.

big if true

Did you just start your first programming course this semester, OP, or are you just that dumb that you think we'd fall for this bait.

...

...

Want something even more retarded?

#include intmain(void){ char s[2]; fgets(s, 1, stdin); return 0;}

No warning with -Wall -Wextra.

Warning with -O1 without -Wall and -Wextra.

int main() { char s[1]; gets(s); return *s;}

wow im hyper triggered

I don't get it, what's wrong with it, reddit friend?

I think the whole "reddit spacing" meme is retarded, but if you feel as annoyed as I do when I see code like that, I understand. I'm sorry I used to hate you ">reddit-spacing" autists, I understand now. I'll continue separating paragraphs with blank lines though.. just squint your eyes and it'll look all cramped up again.

developer.mozilla.org/en-US/docs/Web/CSS/line-height

Actually, that's Holla Forums fucking up my copy-pasted code. Now, do you have an argument, my sweet sweet 9GAG memers?

Kill yourself.

I'm not going to change how I type my posts just so your custom style sheet looks better.

I'll take that as a no. Thank you, 9GAG.

Interesting can you explain?

...

classes with constructors can have side-effects, so you can't just elide these "unused" variables as they actually did something that might change program execution, unless the compiler can detect the constructor does nothing. Who knows what std::string's constructor is actually doing as it changes so often, but the compiler is apparently confident that it has some possible side-effect so has left it in.

just use stdio.h in C++. avoid the cancer.

(((the compiler)))
a great unknown entity

whats so bad about iostream? speed seems to be the same as printexploitf

In what universe?

#ifdef SEPPLES#include #else#include #endifint main(int argc, char *argv[]) { volatile int a = 1; volatile char b = 'b'; for(int i = 0; i < 1000000; ++i) {#ifdef SEPPLES std::cout

Because that also means eastern europe is also awake

Actually, IOStreams don't have to be slow! It is a matter of implementing them in a reasonable way to make them fast, though. Most standard C++ library don't seem to pay too much attention to implement IOStreams. A long time ago when my CXXRT was still maintained it was about as fast as stdio - when used correctly!

Note that there are few performance traps for users laid out with IOStreams, however. The following guidelines apply to all IOStream implementations but especially to those which are tailored to be fast:

1. When using std::cin, std::cout, etc. you need to call std::sync_with_stdio(false)! Without this call, any use of the standard stream objects is required to synchronize with C's standard streams. Of course, when using std::sync_with_stdio(false) it is assumed that you don't mix std::cin with stdin, std::cout with stdout, etc.
2. Do not use std::endl as it mandates many unnecessary flushes of any buffer. Likewise, don't set std::ios_base::unitbuf or use std::flush unnecessarily.
3. When creating your own stream buffers (OK, few users do), make sure they do use an internal buffer! Processing individual characters jumps through multiple conditions and a virtual function which makes it hideously slow.

fuck that's slower than python
$ cat shit.pydef main(): a=1 b='a' print "a number: "+str(1)+", a letter: "+b+", a nothing:"if __name__=="__main__": main()$ time python2.7 shit.pya number: 1, a letter: a, a nothing:real 0m0.019suser 0m0.012ssys 0m0.004s

No, they have to be slow without breaking the standard. The issue is baked into the design. Check out xsputn, for example. All these low-level streambuf functions were defined virtual as people had a hard-on for OOP at the time and templates weren't a fully fleshed out concept both in terms of code and how people thought of their use. The result is code any compliant C++ compiler can never optimize away and a lot of pointless calls.
We need a compete redesign of the strings/streams layer in C++. And also for exception::what() to return a string so you don't have to pay the cost of generating a string people will likely never request or hacking it with a mutable.

The C++ version prints 1,000,000 times. However, the python version modified to print that many times is still actually almost as fast as C++.

def main(): for i in xrange(1000000): a=1 b='a' print "a number: "+str(1)+", a letter: "+b+", a nothing:"if __name__=="__main__": main()

real 0m0.314suser 0m0.312ssys 0m0.000s

This is why people say to avoid this shit in C++.

it doesn't faggot, because you didn't give compilation flags, fuck off piece of shit

holy shit kys

...

Wow omg shes so cute ^^
Using clang from now on!

Delete this shit thread.

see
i understand you want to show off your retardation but this is too much

kek

sage for shit thread anyway

OP didn't mention that, you retard, apparently there needs to be several posts about something to get people actually realize the thing

...

How could anyone get mad like this over such a thing.

...

...

...

Making it volatile prevents the compiler potentially optimizing away a lot of the code. Two files could have been used instead where one calls the other and passes the values to similarly prevent cheating.

...

Surely gender is an enum.

But it does.

What I'm personally pissed about (C++, not the compiler) is it doesn't warn about integer overflow or underflow.
t. large numbers fag.

#includeusing namespace std;int main(){int a1 = 319746;int a2 = 619692056;int fuckMe = a1*a2/a2;cout

on an unrelated note, how do I properly color my code? t.newfag large numbers fag.

The compiler isn't going to wipe your ass for you when it comes to mathematical bounds and precision, you need to know how to use numbers. You're in for a shock when you start using floats.

Use GMP
gmplib.org