« first day (278 days earlier)      last day (4673 days later) » 

sbi
7:01 PM
13 mins ago, by 0A0D
@DeadMG my house sure is bigger than a typical European
@0A0D That's a very American take on "better life".
 
@sbi I am American :)
 
@sbi: I made a custom lexer, and it like, actually works and shit
 
sbi
@0A0D How did I know?!
 
> (**) The fundamental problem here is not so much technical as it is cultural. NASA management seems to have the curious and obviously false belief that the fact you didn't fall off a cliff yesterday is proof that it is safe to walk even closer to the edge tomorrow, even if you're not precisely clear on where the edge is. That is actually an algorithm for ensuring that you always walk off a cliff. The truly awful thing is that they walked off the same cliff in the same way twice.
 
sbi
@DeadMG A lexer that shits? Ugh.
 
7:04 PM
Hehe.
 
lol
 
@sbi Everyone has their take on countries and every country is different.
I think we are doing just fine here :)
0
Q: Convert decimal dollar amount from string to scaled integer

Smurf64"35.28" is stored as a char*. I need to turn it into an integer (35280). I want to avoid floats. How can I do this?

 
@Martinho: What's that identifier word regex thing you had previously?
my lexer is matching strings and identifiers where it shouldn't, and I want to catch identifiers that aren't words so I can break
 
Hmm, [_A-Za-z]\w+.
Not Unicode-ish, though.
 
it'll do
 
7:16 PM
There is no character class for letters.
 
[_\p{Letter}]\w+ if you want Unicode.
 
Of course, Unicode properties.
 
ok
now all I need to do is find out how to actually ask std::wregex to match
 
Er. \p matches property.
\P is reverse.
 
There is an example on Wikipedia I think.
 
7:17 PM
I always confuse the two.
Though \w might not include Unicode characters
 
Well, in that case you go full Unicode on it with \p{Number} thrown in.
 
yay, regular expression error
 
Did you double-escape?
 
yes
L"[_\\p{Letter}]\\w+"
 
:P GCC has raw string literals.
 
7:20 PM
Then the engine doesn't support Unicode property matching.
 
lol
 
What flavor?
 
it's std::wregex
 
Hmm, I have no idea what's the default.
dives into n3290
 
hmm
apparently the string "Wide" does not match the regex [_A-Za-z]\w+
not that I actually know regexes
 
7:22 PM
MSDN says ECMAscript.
Also it should be \w*, unless you want to forbid one-letter identifiers.
 
@DeadMG Ok, that's weird.
Assuming no quotes.
 
no
 
How do you match? Some engines have search/match distinction.
Where search matches anywhere, and match matches perfectly.
 
it's a match
I'm only interested in exact match, MSDN says that std::regex_match returns true only if the regex is an exact match, so it's all good
 
Well, it should work with either one in this case.
 
7:24 PM
You could try anchoring the pattern.
^[_A-Za-z]\w+$
 
nope
hey, what does that $ do?
now it doesn't reject anything
 
$ means the end of input.
^ is the beginning.
 
oh wait
I forgot to put the regex in both functions where it was needed
right
now it correctly rejects the bad identifier
 
1
Q: Why failbit set when eof on read? Is there a way out?

ceztkoI've read <fstream> predates <exception>. Ignoring the fact that excpetions on fstream aren't very informative, it follows my doubt: It's possible to enable exceptions on file streams using the exception() method. ifstream stream; stream.exceptions(ifstream::failbit | ifstream::badb...

 
oh, wait, no it doesn't
this is wtf, I changed one function and now the other is behaving wrong
 
7:29 PM
Well, there is nothing wrong with the pattern, it's something in your code.
 
apparently
if I break on the exception throw, then it always breaks there- even if it's conditional and wasn't actually reached at run-time
sounds like the debugger's just funky to me
I compiled in __debugbreak() calls and now it's working just dandy
although I still don't know what the problem is
it's nice to know that I will no longer accept `` as an identifier
 
Fighting the Markdown?
\
 
apparently, it doesn't want to display backslashes correctly
lol
 
almost beer-thirty gentlemen

http://www.wired.com/reviews/2011/07/beer-froster/
 
7:37 PM
if (current == L'"') {
	while(true) {
		while(input >> current && current != L'"');
		if (!input)
			throw std::runtime_error("Non-terminated string literal");
		if (input.previous() != L'\\') {
			break;
		}
	}
	next(LexedFile::Token::String);
	continue;
	// String literal
}
why do you hate me :(
it keeps terminating when \" is encountered
 
What's previous()?
 
returns the previous character
 
Can't find that in the docs (though it's hard to grep). What type is input?
 
it's a UDT with absolutely no relation to an iostream
except that I made it follow a couple interface conventions so I didn't have to re-write all my code
 
Ah.
If you break on the if, what is its value?
'"' perhaps?
 
7:47 PM
why, yes, it would be
off-by-one in my previous() function
and here was me about to post a real question :P
 
I fixed previous() and now it works just dandeh
 
I'm learning about SSE. I though the compilers were supposed to do these kinds of optimizations.
But I can't get GCC to do it for very obvious cases.
 
ICC will, happily
the trouble is that on x86 targets, not all CPUs have SSE
 
Mine does.
 
7:50 PM
try targetting x64, where all x64 CPUs have SSE2
 
And I asked GCC to target SSE.
 
true, but it generates code targetted at all x86 machines
targetting it usually just means "enable the intrinsics".
try targetting x64, where the compiler can guarantee that SSE2 is available
 
Yeah, if I #include <xmmintrin.h> and compile without -msse it complains.
@DeadMG Hmm, nope.
 
?
 
7:55 PM
bugger
 
Just to make sure, this should be optimizable, right?
 
@MartinhoFernandes newb
 
@sbi The problem with a utopia is that who ensures it is a utopia? How do you ensure everyone has perfect health? Whereas the scale by which traditional America weighs a good life is if a person is able to provide for themselves and expand their wealth (which includes health) without reaching a road-block (infringement of rights). Which means, Americans value self-sustenance. Or at least they used to. Using that mindset, it's easier to understand why they fear government intervention.
 
I doubt it
 
Oh, damn clipboarding script
 
7:56 PM
you will want to greatly increase the size of the array
 
Logic is contextual.
 
oh I love the new tag line :)
 
the compiler probably figures that moving it from a FPU stack register or the stack where it'll be for the cout call isn't worth the cost for just four floats
fill them randomly or procedurally, then go
 
@MartinhoFernandes that looks good!
 
sbi
@Xaade You know, I've lived in the US for half a year, and traveled for another quarter year before that, so I flatter myself believing that I know a thing or to above what the average European knows about American thinking.
Still, even in this light, "my house is bigger than yours; oh, and it's cheaper, too" is a hilarious attempt to explain why someone believes their life is better than mine. Of course, it's also very American.
 
7:59 PM
@JohannesSchaublitb I see four fadds. That's not SSE.
 
@Johannes: Clang output?
 
that's LLVM code not x86 assembler
 
@Martinho: That's LLVM
 
@DeadMG llvm-gcc
 
ah ok
 
8:00 PM
@sbi It's also very European to think that you are better than Americans :)
 
i was too lazy and just used the llvm.org online compiler
 
@Martinho: How did it go with a much larger array?
 
@DeadMG Nope.
I'll try it out later. Now I'm off to dinner.
 
@sbi you should read this : straightdope.com/columns/read/2847/…
 
8:07 PM
So, if old questions pop up from the time where programmers.SE didn't exist. I should flag them to be moved there right?
 
@sbi And my point was that, yeah from the commenter this was a little closed-minded. But the implications of the deep impression from which this comment spurs is little more important. The author believes that his life is better because he doesn't feel constrained to Europe's political notions. He represents this in his mind with self-ownership, or my house is bigger.
 
I wouldn't have a bigger house if I had to live in your society, because I'd be limited. I thought the implied subconscious thought was more than a little obvious. Although I guess your point remains that the American connected the social limits to size of house was shallow.
 
I haven't met one European that has come to here to work and likes America more than his parent Country :) In fact, they stay more often than not in America and don't go back to their parent Country.
 
8:09 PM
lol
 
Who the hell would want a big house, it's just more shit to clean.
5
I can't even keep one room tidy.
 
I would only have a bigger house, and only if, I could afford someone to clean it
 
Hell, I can't keep half of a room tidy.
 
@CatPlusPlus More room and you are not on top of each other
 
@CatPlusPlus I think it's the personal space between houses that's more important than the house size.
 
8:10 PM
plus if you have guests, then there is room for them to stay, etc
 
Meh, how much room do you need.
 
@0A0D Europeans don't entertain guests, they meet up somewhere.
 
user457812
I think it's better to have less room so that guests will have nowhere to stay and go away
 
@CatPlusPlus I have a 1100 sq ft home with a nice yard. I wish I had a 2000 sq ft home
 
8:11 PM
I need a room for my desk, bed and some drawer for stuff.
 
@Xaade For vacation, instead of paying for a hotel
 
Honestly my need for room comes solely from being a parent.
 
@0A0D What is this ft you speak of.
 
user457812
Also, wherever I live should have lots of stairs.
 
@CatPlusPlus ah c'mon...
 
8:12 PM
@0A0D They RENT, I think their accustomed to the high cost of overnight stay.
 
user457812
Stairs discourage the lazy people from entering the event horizon
 
@Xaade There is just so much ROOM in the US. And areas we haven't even developed yet.
 
@0A0D I'm concerned that we see areas as needing development.
 
@0A0D You silly Americans with those weird imperial units.
 
@CatPlusPlus I don't make the rules :)
 
8:13 PM
Honestly, there are benefits to living European style. The walking is one.
 
user457812
You want development? Come to Idaho, we built a ton of houses and nobody is buying them
 
user457812
We've got little suburban ghost towns
 
@nil Who wants to live in Idaho? I am in FL
 
what's European style?
 
The one thing I miss from China, was all the walking.
 
8:14 PM
@Xaade and the smog? ;)
 
user457812
@0A0D I'd pick Idaho over Florida, but I wouldn't pick Idaho over most other states.
 
i've never been to USA. i imagine I would like to be there for a weekend and see whether it's fun
 
@nil Really? wow...
 
@0A0D The smog is over-magnified.
There is no more smog in china than there is in Chicago.
 
@JohannesSchaublitb there was a reddit AMA a while back about a European who came to the US. Gave rave reviews
 
8:15 PM
ohh
 
Depends where you go, America has far more diversified living styles.
 
@Xaade oh yea?
 
user457812
Yeah. Don't go to Alabama.
 
smog over china
 
I would say, if you count the weird.... then yes.... very yes.
 
8:16 PM
@Xaade I would say that I wish portions in America were smaller
we wouldn't be so fat
Though my old Italian/German boss told me that Italians are fat too, so who knows
 
On foot experience is different from a overhead view of china. Smog isn't noticeable.
 
sbi
@0A0D Note that I never said we are better. (Nor has anyone else, actually. But I hadn't even said that our life is better, what the others were saying.)
 
Any more noticeable than in America
 
@sbi: fair enough
 
We're butter.
 
8:18 PM
@Xaade Neither was it in Iraq, but now I have Iraq lung :)
 
@sbi @DeadMG has implied far too often than European life is superior enough to warrant the current conversation.
@0A0D Couldn't be the dust.... nope.
 
I hate my life. Now I have to learn how to use the windows API for serial communications... jesus. Buggy Legacy software should just self-destroy and delete itself completely, no source left anywhere
 
@Xaade And the toxic smoke
 
sbi
@Xaade You know, I have seen my share of US politics, and, as a European, I'm probably at least as happy there's an ocean between that and me as are you the other way around.
 
Also, we don't have software patents.
 
8:19 PM
@sbi we don't like it either :) Waste of time
OK GUYS I WILL JUST END IT RIGHT NOW - WE CREATED THE INTERNET, SO SAID AL GORE. ;)
THERE!
 
sbi
@0A0D Um, wasn't that invented at the CERN, which is in Switzerland?
 
@sbi Don't confuse politics in my comments. I'm very disappointed in the political climate in America. Reasonable solutions aren't found. Solutions that satisfy vote quotas are. And people with their individual interests don't seem to vote enough to protect equal protection under law.
 
user457812
I'm an internet creationist - god created the arpanet and it was good, then some douche with a beard took a few too many bytes of his Apple and it was all ruined.
 
@sbi ARPANET was the brain, created in the US
 
@0A0D Al Gore invented the internet, after he commercialized fear of Global Warming.
 
8:21 PM
 
user457812
It's true.
 
Hey, I can sell fake money to goofs that will pay to look good to the public because activists paint this phoney picture that the public gives a damn.
 
... and the cat is in a pipe...
 
8:22 PM
SIGCAT.
 
meow. who /bin/kill me
 
Damn, I missed 22:22:22 again. By two seconds.
shakes fist
 
now you have to wait 1:1:1!
 
sbi
@0A0D Ah, it was the WWW I was thinking about.
 
@sbi: Yep
 
sbi
8:23 PM
@JohannesSchaublitb Whatever happened to 23:23:23?
 
The bane of our existence.
 
wait. when you missed it, then you have to wait 1:1:0 otherwise you miss it again -.-
that was an off by one error haha
 
I usually experience off-by-one-day error on Monday morning.
 
@sbi if you read more of that article I sent you, apparently CERN was involved in TCP/IP and there was considerable resistance to transitioning to TCP/IP in Europe at the time.
 
23 is a 1998 German film about a young hacker Karl Koch, who died on 23 May 1989, a presumed suicide. It was directed by Hans-Christian Schmid, who also participated in screenwriting. The title derives from the protagonist's obsession with the number 23, a phenomenon often described as apophenia. Although the film was well received by critics and audiences, its accuracy has been vocally disputed by some witnesses to the real-life events on which it was based. Schmid subsequently co-authored a book that tells the story of the making of 23 and also details the differences between the movie ...
 
8:25 PM
We don't speak funny characters.
 
sbi
@CatPlusPlus What? Your language is nothing but funny characters.
 
your language is most vexing
 
@sbi I don't like it either. :P
 
sbi
@CatPlusPlus That might well be, but I don't like it is a long way from I don't speak it, no?
 
8:29 PM
You're either too serious, or I'm too tired.
 
sbi
@CatPlusPlus You are seriously tired.
 
Hibernation time, then. o/
 
right
now instead of looking at an empty Lex() function, I'm sitting looking at an empty Parse() function
 
0
Q: C++: How do you initialize an internal struct's members using an initialization list?

CaseyThis is really two questions, noted below: Currently I have some public internal helper structs (strictly used to pass data around as one object), during construction of an instance of the class I attempted to use initialization lists instead of assignment, but the compiler complained about the ...

 
what's new y'all>
 
8:36 PM
I fixed my lexer, added support for character and string literals and whatnot, did some debugging, and now I think it's really finished
but I've no idea wtf to do in my Parse() function
 
Parse something, I'd say :)
 
no, rly?
 
I have no idea what a lexer is supposed to accomplish
 
lexer says
 
 
8:38 PM
the input program is a namespace, then an identifier, etc
and a parser says "Therefore, you defined a namespace."
 
oh I see
 
or rather
"Therefore, that is a namespace definition", and then the semantic analyzer says "Therefore, you defined a namespace"
 
that makes sense
 
sbi
I always had the impression that, basically, a lexer is just a parser for characters. :)
It gets one character at a time, and decides, "this is an integer literal, this is an identifier" etc.
 
lol
lexers only deal with situations of relatively trivial complexity
what's an identifier is a simple regex and "I didn't already find a quote or a number".
 
8:53 PM
my 420 rep must be a sign
 
@ChetSimpson Any relation to Chet Atwood?
 
@ChetSimpson ¬¬
 
Or Chet Guevara
 
@0A0D nope. I'm deficient in the
bumpkin category
 
 
9:01 PM
or Chet Chet Chong
 
@DeadMG You keep a stack of tokens. You get a token and push it to the stack (shift). You look at the stack and see if you can make a replacement (reduce), e.g, if there is TYPE ID EQUALS EXPRESSION at the top, you can replace that by VARIABLE-DEF. There a shift-reduce parser.
 
I've still been thinking about parallel parsing
 
You can make parsing in bigger chunks instead then.
Like, don't parse function bodies, just lump them together and parallelize their parsing later.
 
I was going to go to statement level
and sub-statement, sometimes
 
You want to parallelise at that level?
 
9:11 PM
think about it- for any semicolon, you don't need to know what was behind the previous semicolon to parse the content leading up to this semicolon
 
But wouldn't those parsing pieces be like, very very short tasks?
Would that yield benefit to parallelise?
 
and that's also mostly true for curly braces- as long as you're not a type or a namespace, then it would be the same, whether you're bracing a for, a while, an if, or a function
in non-trivial programs, I'll have hundreds or thousands of them, or more
admittedly, some granularity adjusting may well need to take place
but conceptually, at least
 
9:28 PM
> No thread safety. You should just use a boost::optional<T>- this has already done the work for you.,
 
@DeadMG boost::optional doesn't provide any kind of thread-safety either.
 
I know- they were two separate points.
 
I see.
 
No, I can't coax g++ to output SSE instructions on its own.
 
9:32 PM
Really?
 
I'm not sure if it's my code (though I doubt it), or the compiler flags.
I'm compiling with -march=native -msse.
Or maybe I'm not seeing the assembly right.
What's fstps?
Float STore Packed Single?
 
not totally sure
but SSE registers are specially named, XMM0-XMM8, for example
 
That's what I was grepping for.
No %xmm anywhere in sight.
This is my program now: ideone.com/hXSoU
 
  69     movd    %edx, %xmm0
  70     movdqa  .LC0(%rip), %xmm2
 
yeah, that should be trivial to vectorise
 
9:42 PM
That it?
 
Yeah.
What did you compile with?
 
It's not your program btw.
 
-march -O3
 
@LucDanton Hmm...march 3. Is that your birthday or something? :-)
 
9:43 PM
I think I should shoot myself now.
I forgot the damn optimization flag.
Now there's xmms everywhere.
 
rofl
I was about to say, MSVC will give SSE code
 
@JerryCoffin I tried thinking of a pun about not having to hum a tune for me on this day but I doesn't look right. Plus it's a deprecated option.
 
@LucDanton Just being glad you're not using it on OS/X, where all options are deprecated. If you don't like Steve's options, just go away!
 
I certainly am glad not to be on OSX
 
9:51 PM
@LucDanton In fairness, I should probably add that it could be worse. Using JCL on an IBM mainframe, it would end up something like:
//CMP EXEC EDCC,
// INFILE='HLQ.SOURCE.C(MYCODE)',
// OUTFILE='HLQ.SOURCE.ASM(MYCODE),DISP=SHR',
// CPARM='march O3'
Thankfully, it's been long enough since I even looked at any JCL that I've probably gotten a lot of that wrong, but you get the general idea anyway...
 
Why on Earth should the lines always start with //? Is that a literate scripting language?
 
You can make JCL/C polyglots!
 
@LucDanton Keeping my final comment in mind, a // is used when you're defining its equivalent of a shell script. Commands without that execute immediately. Or something like that. Or maybe something completely different -- like I said, it's really been a long time...
Doing a bit of checking, it looks like I remembered incorrectly -- lines without the // are for defining data inline. Keep in mind that this all goes back to 80-column punch cards, so having a card deck that included a set of commands to execute, source code to your program, and data to process, all intertwined together was (at least originally) perfectly normal.
 
Thanks for the details!
 
@LucDanton I'm not sure if I should say "you're welcome", or "I'm sorry".
 
10:06 PM
Don't be, I've never used the actual thing :)
 
@LucDanton Good point. If you want to play with a horrible mainframe system, you should really download DTCyber, which emulates a Control Data machine. At least it's not nearly as horrible of a system as an IBM (but then, I'm biased -- my first real programming was on a Control Data running NOS). [Edit: I've given a more direct link]
 
sbi
Discussion about whether or not #stackoverflow is becoming a "nanny state" will not be tolerated by the nanny state. http://t.co/zGjsbGY
 
10:41 PM
Wait, am I stupid?
 
Yes.
Why wouldn't you?
 
sbi
@LucDanton Asking us whether you are stupid certainly doesn't seem a notably wise move.
 
constexpr const char* lit(const char* l) { return l; } What does that do?
 
Assuming it compiles (can you use both constexpr and const?) it's the identity function for pointers to const char.
 
And given template<const char* Name> struct name {};, is name<lit("Hi")> allowed?
 
10:48 PM
Huh, why not?
 
> internal compiler error: in convert_nontype_argument, at cp/pt.c:5369
Oh well!
 
Does it work on a stable version?
 
So silly that name<"Hi"> won't be allowed if name<lit("Hi")> is.
Whoah, there's no chance of that I think.
Well, the error happens on line 5367.
 
You said 5369 before.
 
That's what stability buys you: two lines.
 
10:52 PM
lol
 
I get the error when forwarding as const char(&)[N] by the way, GCC won't accept const char*.
 
LOL
Like an idiot I fumbled with the controls and clicked on the button to see what would happen.
I did not expect that.
Should I move the predicate on its own line?
 
?
Isn't it already on its own line?
 
A line before remove_if
I went ahead and made my answer a tutorial.
 
11:38 PM
Oh, it might make it easier for people that are not used to lambdas.
Btw, I didn't knew that boost-like lambdas were in the standard.
I like them because they much less cumbersome for simple expressions.
 
@MartinhoFernandes They are?
 
In namespace std::placeholders.
 
_1 isn't a lambda, is it?
 
What is it for then?
I'm looking for more info.
 
auto inverted = std::bind(functor, _2, _1);
 
11:44 PM
But I don't really know where to look for.
 
inverted(x, y) results in a call to functor(y, x);
Yeah the full power of std::bind is specified in a complicated language.
 
Oh, they're for std::bind.
 
It goes like this: STL used bind1st/bind2nd/mem_fn (or so I believe), this goes into standardization.
Smart people implement smarter techniques that only require a bind for functors, pointer to members and so on.
boost::bind is one such implementation.
It uses placeholders like _1, _2 for some of its stuff.
This goes into TR1, and later get Standardized.
But meanwhile, Boost is taking yet further with DSLs.
There, _1 is not a placeholder anymore but a polymorphic lazy evaluator.
And so is anything in the DSL.
This is Boost.Lambda and Boost.Phoenix.
 
Oh, std::bind is really powerful then.
 
Especially since decltype came into play.
A good indication on how powerful it is is that we don't need to use something like Boost.FunctionTraits for introspection.
And all this unary_function adapted functors crud.
 

« first day (278 days earlier)      last day (4673 days later) »