« first day (1475 days earlier)      last day (3475 days later) » 

3:04 AM
I have a question
is anyone still here?
Hello
 
hi
 
Thank God you're here
okay so
// Overloading operators
ostream &operator<<(ostream &output, const Fraction &fraction)
{
if(( fraction.numo == fraction.deno) || (fraction.deno == 1))
{
output <<fraction.numo;
return output;
}

output <<fraction.numo <<"/"<<fraction.deno;
return output; // prints a/b
}
 
that's not a question
 
So if the numerator and the denomenator of a fraction are equal then the cout should display only the numerator
but this is not wokring
I don't understand why this is not working.
it should work.
 
user1646075
@Rapptz I wonder if setting up a Code-Buddy section in SO would work. Where people of similar levels agree to help each other along...
 
3:08 AM
ar eyou using floats as numberators/denominators?
 
ints
only integers
 
user1646075
if 4/4 you want to print 1, not 4. If X/1 you want to print X. By the looks of it
 
actually signed integers (if that makes a difference)
Yeah you're right
 
user1646075
just a heads-up, you might push your luck too far asking like this. Also I detect that you might need to reach a hump of understanding your own requirements and translating it to code. 'specification' is an essential part of programming; getting the correct idea of your desired results also needs to be learned through experience.
 
@aclarke you sir are very right. I totally agree with you sir. Thank you for pointing that out.
However, it still does not work
 
user1646075
3:14 AM
heh
 
@Andy That's what she said!
 
Andy, a technique I often use which is very useful when "it does not work" is to keep breaking it down into smaller parts that can not possibly fail in your mind until you find your misconception or the compiler bug.
 
user1646075
luckily you're learning and you have plenty of time to fiddle. Fiddling is an important part of learning this stuff.
 
^ take a look
 
3:15 AM
not pastebin
 
user1646075
@Andy you also! what's that junk in there?
 
TIL you can do 'comments' in markdown by doing [//]: #(comment)
 
@Andy part of the debugging is generating a SSCCE - short self contained correct example
 
it actually works on reddit and github unlike <!--- stuff -->
 
user1646075
slow down and look carefully at what you've really got in front of you.
 
3:17 AM
so when I try 10 / 10
I get some weired number
 
@Andy whenever you get "some weird number" in C++ you need to know two things
@Andy 1. uninitialized variables can and will contain garbage values
@Andy 2. learn two's complement
with knowledge of 1 and 2 you can usually find out why you get "some weird number"
hint: while there is an error in the code you pasted on github, it's not causing the weird number
 
Yeah I know
I do initialize it though
 
not in the code you pasted
this is the importance of the self-contained example
people can not look at your code if it's not included
people will also not wade through hundreds of lines - so it has to be short
usually during the process of creating such an example you figure out yourself why it's broken
@Rapptz I'm doing more intense reviewing/rewriting/implementing myself/fiddling with the formatting code
@Rapptz you seem to have a lot of useless *str == 0 checks
 
where?
 
user1646075
@Andy I have a feeling your previous "it works!" was about it compiling, but not actually about it .... working. You may still have a reference problem. Hence @nightcracker's suggestion to show all relevant code on the gist is important.
 
3:25 AM
sec
 
okay
 
This is a the .cpp implementation of the header file
 
*str is a no-op in *str && trait::Eq(*str, some_non_null_value)
@Andy I could look at it, but I won't
@Andy it's important that you yourself create a short, self contained example
@Andy say ~20 lines max
 
This header file is not big
it's just a small one
for the future I will do that
 
3:28 AM
no, you will do it now too
it's part of the learning experience
 
those aren't useless checks
 
and #100 lines of code is too much for a simple example
 
I'm incrementing the string in a loop
 
what do you mean by short, self contained examples?
can you give me an example?
 
@Rapptz they are useless? Trait::Eq(0, something) is perfectly safe and will be false just as proper as *str will
 
3:30 AM
Oh you mean that.
yeah that's true
 
@Andy A piece of code I can download, compile and run to duplicate your results.
 
@Rapptz it kind of looks like you're being careful
@Rapptz but on closer inspection it's just a no-op :P
 
I've had strange UB with writing/reading past the buffer before.
It's pretty ugly.
 
@Rapptz just look at it case by case
for example *str >= zero && *str <= zero + 9 fails when *str == '\0'
so it's safe
 
yeah
 
3:33 AM
but you're not weird though, I was surprised too that all these were not necessary
usually parsing code is filled with such (necessary) checks
it seems this doesn't require it at all
 
debugging python is a pain
how do people do it
 
I have various methods
my main go-to method is print functions
 
I know where the problem is @aclarke
 
otherwise I use the debugger
 
ValueError: Sign not allowed in string format specifier
thanks Python
fucking over my generic code here
 
3:39 AM
@Rapptz why did you give an arbitrary index to *width and co by the way, and not say "one past the index of the element"?
 
user1646075
@Andy cool what have you found? line number of one of those pages....
 
apparently this is raises an exception: "{0:+}".format("stuff" if condition else 10)
 
line 24
 
pretty great stuff
@nightcracker ?
 
the if is evaluating to false everytime
nevermind
I fix it
I get it
 
3:41 AM
@Rapptz why did you choose for format("|0:.*1|", 5.1243, 3)
instead of
format("|0:.*|", 5.1243, 3)
 
confusing
 
user1646075
by the way, an SSCCE for you would be only the class definition with a plain initializer, forget the gcd stuff for now, a plain outputter, a plain variable initialized to have vlues, and a main that uses it. Sometimes that means you have something that stubbornly insists on working in which case you start putting stuff back until it breaks. Then you know that the last bit you re-instated is the defect.
 
user1646075
@Andy excellent.
 
also you could reuse a width and precision with the positional approach
format("|0:*1.*1| |1:*1.*1|", 10, 11)` works fine for example
 
3:43 AM
(I originally had just bare * in the format spec but decided against it because it was confusing IMO)
 
you could make the position optional
where the default is index+1
 
Have you considered separating the args to be formatted and the args that direct the formatting into two packs?
 
meh, that's even uglier IMO
 
user1646075
@Andy, I also see why you want to keep the members private. I forgot to spec for gcd ;-) Also you do not need to store ch in the class just for the sake of reading a /
 
@Rapptz but despite not convinced what the exact right syntax is yet I think the * idea is pretty cool, did you come up with it?
 
3:50 AM
inspired by printf
does the same thing except *$n and it supports bare * just like you suggest
due to it being va_args I wager
 
I wonder if a type-safe formatting mini language will be specified in the standard in upcoming versions
 
there's std::putf which uses printf syntax
hasn't been rejected or accepted though
 
printf syntax is not type-safe though
or I'm not sure how to put this
 
it'll be just like I implemented it earlier
i.e. it ignores the type specifiers and just uses it as verbs for formatting
 
3:54 AM
like %g is std::defaultfloat
 
IMO a new language is justified
 
yes
it's confusing
 
trying to force fit printf syntax into this is just adding more features to the standard library that aren't terribly useful
 
@aclarke then what would I do if I just wanted to scan the two numbers?
 
@Rapptz have you also thought about combining verbs?
@Rapptz X -> std::hex << std::uppercase
 
user1646075
3:55 AM
since you're scanning like that, may as well just use another local in the >> function
 
oh
 
user1646075
@Andy did you see that separate room I've fired up so we can keep it out of here?
 
@nightcracker I had that originally.
you can do |0:xu| for that now though which scales better I wager.
 
scales in what way?
I think X is pretty universally understood
 
I'd rather just add a verb for std::uppercase than make every other flag a capital letter.
 
3:57 AM
I'm not arguing you should create an VERB for every verb, but the usage with it on X is ubiquitous
 
Yeah I know. Not denying it.
but I'd rather be consistent
 
I'd argue just make an exception for X
 
(i.e. "Why is there X but not E?")
 
because X is used a lot, but E isn't
@Rapptz also why do you have a defaultfloat and no hexfloat?
@Rapptz isn't defaultfloat a no-op anyway?
 
No
defaultfloat unsets all the previous float flags
like std::fixed and std::scientific if for some reason they're there
 
4:03 AM
oh I thought you made this fully stateless?
 
@nightcracker The reason I don't have std::hexfloat is because GCC does not have it.
It was added in GCC 5.0
 
I think it's very important to have the formatting operation be independent of the original state of the stream
so you can use it in generic code
 
It is stateless.
 
then defaultfloat is a no-op?
since setting the default from default?
or am I missing something here?
 
Hm.
It's the last one I added
I don't remember why.
 
4:08 AM
@Rapptz also I consider hexfloat pretty important for debugging, maybe we can implement it ourselves?
 
I think it's pretty stupid that it doesn't have it.
printf has %a just fine
I know it's libc vs libstdc++ but still
I find it inconsistent and bothersome that I can get the behaviour by just #include <cstdio>.
libc++ has it iirc
 
libc++ also has quadratic std::sort
lol
anyway
I'm too tired to get anything done by now
so I'm going to bed
@Rapptz I'll see if I can finish my implementation tomorrow
I am using {} instead of || though :P
 
Why does juice taste better straight from the container instead of the cup?
I can't shake off this placebo.
 
user1646075
because it's illicit
 
user1646075
i've also noticed that a fish you caught yourself tastes 5-star, especially if you can get someone else to clean it.
 
4:59 AM
@Rapptz lol. I must admit I'm also like that.
Good afternoon.
 
user1646075
afternoon
 
7:25 AM
marning
 
Good morning.
 
how are you?
 
Fine at work Bored.
 
oh fun
 
Just finished a feature and I'm just waiting to report... boss not here yet.
 
7:28 AM
I'm still waking up
 
But it feels weird with text perpendicular to your arm's length.
"Be more productive by having 20 devices instantly and at the same time notifying you of an email."
IoT truth.
 
yea
that's the issue with all these smart things, you get notified about the same thing 3 times instead of once
 
It's already very annoying having Skype both notify my desktop and laptop.
 
7:55 AM
Morning
Is RAM considered "cache"?
 
Depends on use.
@Jefffrey Good morning.
 
@Jefffrey ... well, yeah. There's nothing preventing you from creating a computer that uses the hard drive directly without involving RAM.
 
But yeah, it's a pun so...
 
I think cache mostly refers to on-die CPU type cache
 
7:59 AM
@MarkGarcia Except performance you mean?
 
I've never heard anyone refer to RAM as cache
 
@TonyTheLion Game engine programmers often do.
 
#gamedev
 
hahah gamedev
 
8:01 AM
best dev
 
@Jefffrey Yes. It's tiered, like from hard drive to L1.
 
@Jefffrey RAM is used by the OS to cache stuff.
 
@MarkGarcia Yeah, Hard Drive > DRAM > L3 (SRAM) > L2 > L1 > CPU registries
 
but main memory isn't cache so this is silly
 
I've studied a little bit of computer architecture.
 
8:03 AM
Congratulations.
 
Forgot almost all of it.
 
I quite like computer architecture
unfortunately I haven't studied it much
 
Computer architecture is implementation detail :P
 
Your mom was an implementation detail.
 
8:05 AM
rofl
 
I studied a little bit of your mom.
 
lol
puppies everywhere
 
At least that your mom joke makes sense!
It's an implementation detail that your mom made you ( ͡° ͜ʖ ͡°)
 
@Jefffrey Yeah. The C++ standard happened to (vaguely) define a computer architecture for its programs to run on. Then people began implementing it into what we know now.
 
8:07 AM
I just bought Fantasy Life for my 3DS and I'm waiting for it to finish downloading.
 
@MarkGarcia true
@Rapptz Congratulations.
 
I decided to try a bit of Rust and I ended up reading bad memory.
 
Thanks man.
@LucDanton Is your job to break compilers/languages?
 
No.
 
You should consider it eh
:p
 
8:09 AM
I was converting [(a, b) | (a:tail) <- tails xs, b <- tail] to Rust.
 
hmm
Why tails xs initially?
 
huh?
 
That basically removes the first element from the list
 
that's tail
 
@Rapptz I don’t know, the compiler was doing a good job. I thought sprinkling a little bit of erasing on top would be the right magic to make it compile. Which it did, but I didn’t expect the bad reads.
 
8:13 AM
@Rapptz wait, isn't tail the function?
 
yes tail is the function that removes the first element from the list
 
tail (_:rest) = rest
ye
 
mhm
 
sbi
Morning.
 
hello
 
8:14 AM
but it's shadowed in there, right?
morning
 
sbi
@BartekBanachewicz Why do you think so? There's currently no job ad out there, but I am sure if you are good in C++ (which I believe you are) and make the impression you can get along with (real) people, you will be hired this winter. (But didn't you want to stay with your girlfriend? Something happened?)
@R.MartinhoFernandes Well, whodathought... :-(
 
> fn flat_map<B, U: Iterator<B>>(self, f: |A| -> U) -> FlatMap<'r, A, Self, U>
Does 'r come out from thin air? wtf
 
ugh sigils
;-;
 
these are my concernes, regarding [(a, b) | (a:tail) <- tails xs, b <- tail]
 
Not really a sigil.
 
sbi
8:17 AM
@R.MartinhoFernandes Did you know that males are particularly bad at going to the doc earlier? It's likely to be a rather important reason why men in a (heterosexual) partnership live longer than single men.
Anyway, this is worrying. If you are in acute pain, maybe you should go to a hospital? Lest, you know, your future self gets angry at you because you didn't.
 
> fn flat_map<B, U: Iterator<B>>(self, |&'a T| -> U) -> FlatMap<'r, &'a T, Items<'a, T>, U>
^still out from thin air
 
@Jefffrey TIL Coliru has Haskell. Nice.
 
Not officially
 
There's lots of stuff that maybe @StackedCrooked hides a very special easter egg in it.
 
8:21 AM
also ruby
and python
 
Oh, it’s a doctool bug. It appears in the source. Now I have to figure out what |A|: 'r -> B is.
 
RecursiveAttribute.h:84:39: error: unused parameter 'attr' [-Werror,-Wunused-parameter]
void Unpack(const RecursiveAttribute& attr, T& t) = delete;
^ Warning for unused param in declaration??
 
Why do you put named arguments in declaration?
I'll never understand why people do that.
 
documents code
the hardest part of an RPG
the gender
 
does having void func(int x); and then void func(int y) { ... } generate errors?
 
8:26 AM
no
 
too lazy to check
 
@sbi I misread your tweet :S. Blame on me. Sorry for the confusion, but it was me who got confused in the first place :P
 
oh ok
 
@Rapptz I read that as one with the two previous sentences. Boggled my mind.
 
the girl choice has bobble hair and side tail hair
I'm picking chick
too kawaii
 
8:30 AM
Oh, Rust closures don’t go down do they?
Alright, don’t think I’ll bother with this until more of the planned closure improvements are rolled out.
 
now I have to give a voice and a name to my cute female character
watdo
I am artificially limited to 6 characters.
 
So you can do r.flat_map(|i| range(*i, (*i)+3)), but r.flat_map(|i| range(*i, (*i)+3).map(|x| x + upvalue)) I’m not so sure.
 
@Rapptz Rapptz
Your name sounds cool, even for a game character.
 
I went with Jess
but I could go for Rapptz
I have succeeded in making a cute character.
it only took an hour but it was worth it
5
 
8:48 AM
> playpen: application terminated abnormally with signal 4 (Illegal instruction)
I find C++’s capture-lists surprisingly more useful.
 
Xeo
@Rapptz Whatcha playin?
 
Fantasy Life
 
@LucDanton Heh, interesting.
 
the fuck the pixels
 
8:52 AM
@Rapptz 6 chars are very few
 
is this thing from 1990
 
@LucDanton It generates different output for different optimization levels. Is there some sort of UB in the Rust language?
 
@VáclavZeman Yes.
Normally it requires writing/using unsafe code. AFAIK I did no such thing.
 
@LucDanton That's because it's a great feature :v
IMO anyway
 
8:54 AM
It's well done.
@LucDanton What are those '''s?
 
@Rapptz I was going to say ‘but it’s not as concise’, but that’s because I refrain myself from doing [&]. Which is what those Rust closures amount to. So, I would have to agree.
@MarkGarcia Denotes lifetime parameters.
 
gaaaah why is the race tomorrow WTB time travel device
3 #haskell projects among out last updated bitbucket repos :) It's slowly taking over everything #CantStopWontStop http://t.co/K3JnvePirU
 

« first day (1475 days earlier)      last day (3475 days later) »