« first day (832 days earlier)      last day (4134 days later) » 

12:00 AM
@FredOverflow Ewe donut think I count?
 
user142019
@JohanLarsson unitless, but the scale is from C (not awesome at all) to Haskell (more awesome is impossible).
 
@FredOverflow was thinking minute/wtf
 
user142019
lol minute/wtf
 
user142019
lol
 
but how does that work in the negative?
 
user142019
12:01 AM
Even less awesome than not awesome at all.
 
time starts going backwards maybe
 
hrrnggg
 
inverse evolution
 
I bet my code would be measured in wtfs/second.
 
@JohanLarsson Devolution. Are we not men? We are Devo!
 
user142019
12:02 AM
@Mysticial at least it's not C or C++, so it can't be that bad.
 
@JerryCoffin we become apes, then insects
 
user142019
(Assuming no Java and no PHP and no VB.NET.) xD
 
@Mysticial said by the person reading it?
 
@doug65536 Yeah.
I don't think "reading" would be the right word.
 
lines/wtf seems like a valid performance metric for code reviews
 
12:03 AM
I'll be like "choking".
 
@JohanLarsson No, Devo.
 
@Mysticial I have pondered that a little, settled for 0 - 240 wtf's/minute on the meter. My thinking is that zero would never be sustained for a whole minute but kept it any way
 
user142019
@doug65536 old joke.
 
@JerryCoffin ah pun time
 
seriously though, you have to try to find the middle part where you don't do it so simply that you look like a fool, and not so complex that you look like a fool
 
Try it on this:
Apr 16 '12 at 4:38, by Mysticial
#define ymi_CVN_u64d19_to_strd_u1_SSE41(T,A){   \
    const __m128d _SCALE0 = _mm_set1_pd(0.000004096);   \
    /* const __m128d _SCALE1 = _mm_set1_pd(4096.); */   \
    const __m128d _SCALE2 = _mm_set1_pd(0.000000001);   \
    const __m128d _SCALE3 = _mm_set1_pd(0.00000001);    \
    const __m128d _TEN = _mm_set1_pd(10.);  \
    const __m128d _ADD = _mm_set1_pd(0.00000000000001); \
    const __m128d _MASK0 = _mm_set1_pd(4503599627370496.);  \
    const __m128d _MASK1 = _mm_castsi128_pd(_mm_set_epi32(0x000fffff,0xffffffff,0x000fffff,0xffffffff));    \
And measure how many WTFs/second you get.
 
WtfOverflowException?
 
@Mysticial There's a point at which code is...dense enough, it's more "hunh?" than "WTF?"
 
user142019
@Mysticial PREMATURE OPTIMIZATION
 
@MarcusStuhr dying?
how come mysticial can get away with raping the preprocessor
2
 
user142019
12:07 AM
I'm in love.
 
@Rapptz No everything is fi---urrhnrnnggg
 
@Zoidberg It gave about 2.5x speedup over the normal method. Good enough for me.
 
@Mysticial you sure you're gaining much by computing those way ahead of time? You're forcing it to use memory accesses unless the compiler is smart enough to calculate it on the fly
 
@JohanLarsson I'm proud of my pushur thing :D
 
12:08 AM
@Rapptz is the source available?
 
@doug65536 Those are compile-time constants that sit in memory.
 
yeah I suppose it would have started with the set1 constants anyway. nevermind
 
I've intentionally written all the code so that that can be accessed with memory-direct instructions.
 
@JohanLarsson it is on a private repository.
 
room topic changed to Lounge<C++>: Chivalry free weekend on Steam, let's play it [c++] [c++11] [c++-faq] [get-out] [no-questions]
 
12:09 AM
posted on January 24, 2013 by Eric Battalio

This is a follow up to Jumping Into C++, a first-hand account of my experiences writing my first modern C++ application. It was a simple exercise that turned out to be not so simple and much more educational than I imagined thanks to the community. Thank you. And now, in no particular order, a few thoughts. About not using regular expressions. I avoided regular expressions early in the proje

 
thinking it could use all register operations if you compute those where needed and entirely skip the memory accesses but I don't have near enough context to know what you're facing there
 
@doug65536 Are you looking at the whole thing? Or just the one-box preview above?
 
@doug65536 by the way, Mysticial holds world records for this kind of stuff. Don't doubt the Mysticial.
 
user142019
I'm proud of ø.
 
@Mysticial just the little fragment
 
12:10 AM
There' about like 16 constants. And 15 live variables that need to be kept in register.
@doug65536 Click through to it and see the rest of it.
 
Ell
Yeah he's a world record holder
Twice I beleive
 
But don't ask him for C advice
 

Lounge<C>

C Programming Language Board: It's like an answering machine; ...
 
Dude that entire thing is a macro?
;_;
 
user142019
@Rapptz Leave him alone. He can't help he doesn't know C.
 
12:13 AM
oh, another LOUNGE<C>
 
user142019
:P
 
@CatPlusPlus You like that game way too much.
 
@Rapptz Yes
 
Why? :(
 
@EtiennedeMartel Hey, it's free
 
user142019
12:15 AM
Dog vomit is also free and I don't use it either.
 
I don't know if I'm gonna buy it, but we could try it out in practice
 
@Rapptz It's the only thing inside a critical loop.
 
I have a soft spot for those kind of games after Pirates Vikings Knights :v
 
IIRC, that entire macros runs in like 80 cycles. I didn't need an extra function call on top of it to make it any worse.
 
user142019
forceinline :P
 
12:17 AM
@Zoidberg do you know objective corporate speak?
 
@Zoidberg There's actually multiple problems with that.
 
user142019
@JohanLarsson no, but I do know Objective-C, and both seem terrible.
 
One, I'd need a separate pragma for each compiler.
Secondly, compilers don't always successfully optimize out the stack movement of an inlined function.
Here it actually mattered.
 
@Zoidberg did you check out the syntax?
 
@Mysticial you must mean gcc :P
 
user142019
12:18 AM
@JohanLarsson It's worse than C++'.
 
@doug65536 And MSVC. And ICC.
There's a lot of these macros in the y-cruncher code. This is one of the few that can actually be done with functions. I chose not to for reasons of performance and consistency.
But the vast majority of the low-level macros cannot be turned into functions.
 
@JohanLarsson what does it do?
 
user142019
I have never used SIMD directly.
 
That's because the datatypes are actually part of the parameters. So they can be done with templates. But this is C, not C++.
 
user142019
Macro abuse level: y-cruncher.
3
 
12:21 AM
lol
 
user142019
I'm abusing IORefs because I suck.
 
@melak47 use mouse wheel to adjust then just leave it open until something changes (it does nothing really)
 
I believe that snippet is part of the digit viewer that will be open-sourced. So if anyone is insane enough to want to see how it is used...
 
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
;_; std::locale fucking sucks.
 
user142019
Well, don't use it.
 
user142019
12:24 AM
PROBLEM SOLVED.
 
I wanted a quick and painless way to print a number with commas.
 
@Rapptz y-cruncher has a 30-line function that does it.
 
user142019
$my_number =~ s/\./,/g;
 
@Mysticial sauce? :D
 
user142019
Ketchup.
 
12:25 AM
@Rapptz idk if I have a pedantic as hell one lol
 
pedantic in what sense?
 
I take it back, it's not 30 lines.
 
recursively divide by 1000 put the commas in as you return
 
@Mysticial is it 100 lines
 
It's 60 lines - more complicated than I thought. And it also supports right-aligning to a margin.
It won't be useful if I dumped it here though. It's littered with my custom datatypes.
Hang on a sec while I replace them with standard types.
 
12:29 AM
I'm an experimental government aircraft
 
here's one in three lines
10
A: Is there a built-in function that comma-separates a number in C, C++, or JavaScript?

Loki AstariYes this can be done automatically in C++ by setting the correct facet on the locale. #include <iostream> #include <locale> #include <string> template<typename CharT> struct Sep : public std::numpunct<CharT> { virtual std::string do_grouping() const {re...

 
in Teenage Programmers Chatroom, 1 min ago, by Mr D
@CCInc What's wrong with Java?
 
@Rapptz I guess that does it.
 
it would but my locale is retarded
 
@CCInc it's too easy and has an easily usable library and strong documentation. CAN'T HAVE THAT.
 
12:30 AM
lolz
 
Microsoft doesn't even have a list of locales
Like, what the fuck man.
 
what exactly is the point of an interface? Like those classes that just define the methods for another class?
 
user142019
my $num = 3.1415;
(my $str = $num) =~ s/\./\,/;
print($str);
 
@Zoidberg What IS wrong with Java?
 
user142019
@CCInc Everything.
 
12:34 AM
If you don't want to right-align the numbers, just set the second parameter to zero.
 
What's this? 9 * 4 * 4/3 + 3
 
@Crowz Ahahahaha
 
user142019
An expression.
 
@Rapptz It would become very rapidly outdated.
 
12:35 AM
@Rapptz An expression for how large the buffer needs to be.
 
@DeadMG I figure, because I found one and it was wrong :(
@Mysticial Oh, I meant what do each number represent?
 
Here's one I dug up in old code: ideone.com/odXuxs
 
This is cool though, thanks Alex.
 
@Rapptz Um... it's been years since I've touched that. So I don't remember all of it. The 4/3 is the conversion factor from no commas to with commas. The +3 at the end is a safety buffer to make sure it rounds in the right direction. I don't remember the 9 * 4 part. But it has to do with the initial size.
 
@Mysticial 9 decimal digits per int, time 4 bytes per int?
 
12:38 AM
@Rapptz It's the exact same print with commas function that y-cruncher has been using since the beginning.
 
@MooingDuck an int has 10 decimal places
 
@Rapptz I was just thinking that yeah...
 
@MooingDuck Not sure. It really has been years. Possibly 4 or 5 years.
And I believe that estimate overshoots.
 
but this is also uint64 so it has even more than that (20)
 
If I were to rewrite it today, I'd just do 20 * 4/3 + 3
 
12:40 AM
no wait, multiplying decimal digits per int times bytes per int is decimal-digit-bytes per int squared, that makes no sense.
so my guess was wrong
 
Also...
Don't forget that I was a shitty programmer 5 years ago.
So that 9*4 could have had no meaning at all.
 
Did you think it sounded 1337 enough
 
Did I think what sounded 1337?
 
initial size of std::vector- 1337.
 
9*4 * 4/3 + 3
it rolls off the tongue nicely.
 
12:44 AM
And if you're wondering about all the color-changing that y-cruncher does. That's a separate API. Basically, there a command that lets you change the color for all prints after a specific point.
@Rapptz Oh and... I believe the return value is how many characters were actually printed.
This includes the margin spacing. So if you specified a margin of 20, and the number doesn't exceed it, then it should always return 20.
If the number exceeds the margin, then it will ignore the margin and use as many characters as needed. (and will return the right number)
 
This is very C-like, you do know C!
It's got everything, a buffer, a C-string, printf
 
printf > cout
 
while(*pstr != '\0') is redundant though
 
y-cruncher is written in C. So of course it's C.
:)
 
@Crowz variadic templates type-safe printf
 
12:49 AM
@Rapptz I always thought cout was annoying imo
 
noob question, what does *str++ mean?
 
It's a star string ++.
 
it means read the character pointed to by str, then increment str
the result is the character it read
 
increment?
 
12:52 AM
add 1
 
@Crowz Yes. You first dereference the pointer and return the value.
 
the ++ binds to the pointer, not the value
 
Then you increment the pointer.
 
to... to a character pointer?
 
its tmp = *str; ++str; return tmp;
 
12:52 AM
@Crowz We don't know that.
 
How do you increment a pointer? Sorry if that's a noob question
 
++str or str++ - although I doubt you really didnt know
 
str++
 
no no I mean what does that DO?
 
@Crowz It increments a pointer.
 
12:55 AM
it adds the size of the type it points to to the raw address
 
It makes str point to the next element in the array.
 
huh.
 
C-style strings are hard.
 
^ That, don't think in addresses
C-style strings are shit
 
yeah I know lol
 
12:57 AM
you have to think in addresses to understand pointer arithmetic though
 
Yes
 
@CatPlusPlus so you think C programmers should have no idea whats happening underneath?
 
Distance maybe
C programmers shouldn't exist
 
C programmers are awesome
 
12:58 AM
@doug65536 for char yes, for other types no.
@doug65536 not really
@doug65536 they probably do, it's just not needed.
 
C is nearly assembly. what were you expecting?
 
A decent language
C is not it
 
seems decent enough. there are several operating systems
 
<mrout> You can do OO in C, you can do generic programming in C.
<mrout> it's fucking easy to do OO in C.
I love people who say such things. They deserve to be made fun of.
 
It's funny because it's easier to do encapsulation in C than C++
 
1:00 AM
@Griwes he's right. It's easy to do most OO in C.
 
@Griwes yeah, it's easy to manually do the C++ compiler's job in C++ with structs of function pointers and tricky pointer arithmetic
 
@MooingDuck Like, GTK+ish OO?
 
Subtype polymorphism is bit manual in C, but doable
 
@doug65536 OO != virtual functions.
 
Stop thinking about pointer arithmetic jesus
It's not needed for anything
 
1:01 AM
@DeadMG true, and IMHO C allows better hiding of implementation than C++
 
@Griwes the syntax is different, but the only "tricky" thing is virtual functions. And even that isn't all that tricky.
 
@doug65536 No, it doesn't.
 
@doug65536 no it doesn't
 
It's not tricky but very tedious
 
casting from one type to another requires you to know pointer arithmetic right? lol j.k
 
1:02 AM
@doug65536 no it doesn't
 
@DeadMG It actually does, you need more boilerplate to do it in C++
 
Oh well, C++ers liking GTK+ish OOish something.
 
@CatPlusPlus How so?
 
yes it does
 
If anything C++ hides it so well that you don't even know that you're shooting yourself.
And even worse: You don't even know when you have shot yourself.
And you don't even know even after you have shot yourself.
 
1:03 AM
then explain why I have to completely explose all details about the data structure to clients in C++. using a pure virtual base and going entirely through vtbl?
 
@Griwes C++ is hardly any better implementation of OO
@DeadMG Compilation firewalls exist
 
@CatPlusPlus Said Javaist :D
 
C++ is worse than crack. When you use C++, you don't even know if you have shot yourself and are bleeding all over the place.
 
@doug65536 (1) you don't (2) C is exactly the same in those two regards.
 
@Griwes Java isn't better than C++ in that
 
1:04 AM
@CatPlusPlus You can use any compilation firewall that you can use in C that you can in C++.
 
Or anything
 
Anyway, three silly tests tomorrow. I should get some sleep.
 
@MooingDuck yes you do. (does saying 3 words make you sound right or something?)
 
@DeadMG I guess you could do opaque handles in C++ too, but then it would be writing C really
 
At least, my troll mission has been fulfilled. I have spread another trollish C vs C++ debate from one place to almost four. It's been a good day o/
G'night.
 
1:05 AM
And other than that you have PImpl or virtual base which makes it harder to work with values
 
you have to write a pure virtual base and then hide your implementation behind a factory, forcing many compilers to entirely call through vtbl. Then all clients MUST use pointers
 
@CatPlusPlus Eh, I disagree. It would only be C if you did not use any other C++ feature- e.g. taking a std::string in constructor.
 
@doug65536 why do you say you have to completely expose all details about a data structure in C++? That's not true in C++ any more than C. Second, I don't see what you're saying about "pure virtual bases and going entirely through vtables". (I know what that is, I just don't know what you're saying about it)
 
I like C and C++ for different things.
 
@doug65536 same with C
 
1:06 AM
typedef struct foo *foo_handle;
foo_handle foo_create(...);
void foo_something(foo_handle, ...);
void foo_destroy(foo_handle, ...);
// that looks like C++?
 
delicious C++
 
nevermind, it already does :|
ok now do that with C++
 
typedef struct foo;
struct foo_handle {
    void something(...);
    ~foo_handle(...);
private: foo* ptr;
}; //this sure does
 
In C++ you'll either have struct foo { interface; private: class impl; pimpl_ptr<impl> m_impl; }; or struct foo { virtual interface; }; struct foo_impl : foo { implementation; }; unique_ptr<foo> make_foo(); /* creates foo_impl */ and both of those involve more boilerplate
 
a wrapper. very funny
 
1:08 AM
Maybe not significantly more but still
Virtual bases suck anyway
 
you can drastically improve recompile time with extensive use of virtual bases (you know what I mean) but I NEVER do that anymore
 
They don't bring any more improvement than PImpl
And they have more drawbacks
 
thats what I mean. forgot the term
yeah I see what you mean too though, there isn't much difference C++ or C wise, still not knowing sizeof the type etc. I guess it's more natural to hide everything in C if you are simulating C++ things in C
 
I like you guys
 
I learn to rethink arguing with cat plus plus soon ... lol
if he sounds wrong, you must need to reread what he said :P
 
1:23 AM
@doug65536 nonononono, you learn to rethink whether or not to argue with the cat. :P
 
I wanna be a cat when I grow up
3
 
@CatPlusPlus Depends on the contents of the ..., don't you think?
 
@DeadMG No
 
@CatPlusPlus Difficult to argue that it's C if you have std::move(unique_ptr) in there.
 
It's not idiomatic
 
1:27 AM
but secondly, PIMPL has something that opaque handle doesn't- the user can treat it like any other type.
 
It really doesn't matter what arguments it takes
 
you could just make a function with _move at the end and pretend its the move constructor, right?
 
it's slightly more boilerplatey, I admit, but the result is superior
 
1:45 AM
Is anyone else having trouble getting on steam?
 
@Mysticial I'll check
 
thx
 
@Mysticial I get a network error
 
k, then it isn't just me
 
I am online on Steam
 
1:53 AM
you guys don't love me like you used to
 
I was trying to launch TF2 for the first time in months. And it hung on the update.
I tried to close it, but it didn't, so I killed it. And now I can't get back online.
 
Hey, anyone know how to get OEP of ASProtect 2.56? Found only lower version how tos.
 
@Crowz <3
 
@Crowz The fact that you haven't been booted out means we love you.
 
I'm honestly kind of surprised I haven't been banned
 
1:56 AM
I checked the access list and I have explicit write access.
Made me feel warm and fuzzy inside.
I just noticed the robot's About message is grammatically incorrect
 
finally, steam booted and logged me in
 
I'm patching something, probably tf2
 
same
It's horrifically slow though.
 
@Rapptz Wha?
 
@DeadMG "an Unicode expert" should be "a Unicode expert" shouldn't it?
 
2:03 AM
No...
 
yes
 
@CCInc How do you pronounce Unicode? o.O
 
uhh
 
the U in Unicode is more like younicode
 
2:03 AM
and "an younicode" isn't korrekt
 
that's hellgay brah.
 
I'm aaaaaall alone on Minecraft
 
minecraft suxxors
^^
 
2:20 AM
Wow I actually know what to do for my compsci assignment!
This is a first
 
In other news.
 
does this leak memory? ss.imbue(std::locale(ss.getloc(), new Separator<char>())); ?
 
2:39 AM
Hello, C++!
 
Hi.
 
@Crowz Nice to hear!
-1
A: C++: Integer input restricted to four digits only

Code-GuruI like your idea to use a string as the input. This makes sense because an account "number" is simply an identifier. You don't use it in calculations. Using if (sizeof(input)==4) will check that the user inputs 4 characters. Now you need to make sure that each of the characters is also a digit. Y...

I'm saddened that someone would downvote such a good answer ;-(
 
sizeof(input) == 4 doesn't return the length of a string.
So it's incorrect
 
@Rapptz oops...
lol, I missed that
 
Try input.size or input.length
 
2:42 AM
@Rapptz Yah...I do know the correct way. I blindly copied the OPs code...
 
OPs code is usually bad
 
-1
A: C++: Integer input restricted to four digits only

Code-GuruI like your idea to use a string as the input. This makes sense because an account "number" is simply an identifier. You don't use it in calculations. By if (sizeof(input)==4) I think you are trying to check the length of the string. The correct way to do this is if (input.length() == 4). This wi...

Better?
@CatPlusPlus I should certainly know better. The idea was sound, though.
@CatPlusPlus The main point I wanted to make was using a string for an account "number" is preferred (IMO) to using an int.
 
Cat wouldn't care
Honestly if I were to do it I'd just do it like this
does GCC not support the u8 prefix?
 
UTF-8 literals are plain broken anyways
 
I didn't want to edit my code and have Luc's brain yelling at me because '0' depends on machine
:(
 
2:59 AM
Luc?
Is there a required rep in order to suggest edits?
I don't remember and now I have enough rep to make any edits I want without putting them into the Suggested Edit queue.
 
< 2000
 

« first day (832 days earlier)      last day (4134 days later) »