« first day (602 days earlier)      last day (4361 days later) » 

6:00 PM
is it easy to implement? I don't want to spend a day on this
nope, its part of a homework assignment, we have to write a compiler
so all of our input is valid
 
bool found_decimal_point = false;
char chr;
while (chr = *str++) {
  if (chr == '.') {
    if (found_decimal_point) break;
    found_decimal_point = true;
    continue;
  }
  if (!std::isdigit(chr)) break;
}
// C++, but shouldn't be too hard to rewrite in C#.
 
its nothing too fancy
 
Then you will be needing a lexer. They didn't tell you how to do this in class?
 
no, he doesn't go over code in class
 
Typically they should tell you what tools to use.
 
6:01 PM
my school is horrible
 
How can they grade it if everyone does something completely different?
 
by the output i guess, he doesn't even know c# and thats what half the class is writing it in
 
So essentially your teacher is a pointy-haired boss.
 
lmao
you hit the nail on the head
all of our cs professors are like that except 2
 
If you can write it in any language, just use C++ with the algorithm I wrote above. It might contain bugs, but that's not my problem.
 
6:04 PM
Well… what's the overall scope of this language?
Is it just like a fancy calculator, or is it a full functional language? Or object-oriented?
 
boost::lexical_cast ftw.
 
There are tools to make language implementation easy for students… Flex and Bison were used at my uni.
 
i got your regex to work anyway, but i'll look into flex
c# is like java
 
Also use Boost.Spirit.
 
just uses the .net framework
 
6:06 PM
C# is like Java only ∞^∞ times better.
 
LOL… I have yet to see a real tutorial for Boost.Spirit…
 
Fast question, without any "trolling": Which one? Eclipse CDT or NetBeans C++?
@RadekSlupik: +1
 
@Shiki NetBeans for sure.
 
so are regular expressions a thing of the past then?
 
Unless you want C++11, in which case you should go for Xcode or Emacs with a C++11 mode.
@StephenGranet Regular expressions are very difficult to get right for non-trivial things.
 
6:08 PM
@StephenGranet Nah, still good to know. But they're not really for industrial-grade work.
 
oh okay
 
If you want to match simple things like *markdown* in _chat_, fine, use a regular expression. Anything beyond that is just a real pain in the ass with regexes.
 
They feel fast because they're inconvenient. And it's true, there are hardware regex accelerators. But for the most part, they're painful to write and slow to execute.
 
I want to see a regex compiler as a constexpr template operator"" in C++.
It's not impossible.
 
(I did an internship at a company that made hardware regex engines for network accelerators, but never got around to asking how you would access such a circuit in code.)
 
6:10 PM
template<char... R>
constexpr regex operator"" _regex() {
  // …
}
auto regexpr = "[a-zA-Z_]+"_regex;
 
@RadekSlupik - I tried choosing by popularity (of each IDE), sponsors, and stuff. Why do you prefer NetBeans over Eclipse?
 
@RadekSlupik Nope.
 
@RadekSlupik So you implemented a regex feature which is completely not in the standard, while we're all waiting for the standard libraries…
 
Can't use templated UDLs for string literals.
 
@RMartinhoFernandes Not?? That's stupid. -_-
@Potatoswatter operator"" is standard.
@Shiki I like NetBeans for its UI, primarily. The Eclipse UI is somewhat difficult to navigate.
 
6:12 PM
@RadekSlupik Yes, I'm talking about the standard regex library. The one where you choose if you want POSIX regex or ECMA.
 
Not that I used Eclipse very much.
@Potatoswatter libc++ already implements std::regex, and I wasn't talking about that.
 
@RadekSlupik You have to access the string as a constexpr array. The char ... parameter pack is only for decimal literals.
@RadekSlupik I was just making a very lame joke.
 
im taking off, thanks again, appreciate it
 
Später.
 
@StephenGranet Good luck! There's a lot of fun to be had with parser generators. And the really popular ones likely work with C#.
 
6:21 PM
I'm writing a kernel. I'm bored.
 
With the UDLs taking a string as char const*, you can't compile the thing at compile time.
 
@RadekSlupik What bootloader?
 
@Potatoswatter GRUB.
 
@RMartinhoFernandes Sure you can. Why not?
 
Because the return type is fixed.
 
6:22 PM
Any decent boot loader would suffice though, the kernel supports Multiboot.
 
You can't make the result type depend on the contents of the string, but you can compile a regex.
 
You can produce a some kind of tree, but that's it.
 
@RMartinhoFernandes Can't you do template<char... C> struct foo{} and some template magic and then return foo<R...>?
 
6:25 PM
The best you can do is use char const* template arguments.
But that's painful for simple things.
 
I wish there was "foo"... which would expand to 'f', 'o', 'o'.
 
Hehe, C++ would be getting all emo… "emo"...
 
Cutting them in pieces?
Otherwise I don't get the joke.
 
Quoting everything and adding an ellipsis. Not a mature use of punctuation.
Don't do it, man! Remember the joy of UTF-8!
 
UTF: Uhat The Fuck!
 
6:29 PM
UTFUTF = WTF
 
You know what's WTF? Assembly.
.global _idle_impl

_idle_impl:
  pushl %ebp
  movl %esp, %ebp
  hlt
  popl %ebp
  ret
I'm not even sure if it's correct __cdecl. xD
 
That's silly.
 
What's silly about it?
 
*Dis*assembly is a useful reverse engineering tool. The assemblers we're saddled with are just bastardized disassemblers working in reverse.
 
@RadekSlupik Why not just type hlt instead of call _idle_impl?
 
6:31 PM
@RMartinhoFernandes Because I need to call it from C++ code.
[[noreturn]]
void panic(const char* const message = "") noexcept {
  // TODO: Save stack dump.
  // TODO: Print message.

  for (;;) {
    idle();
  }
}

void idle() noexcept {
  idle_impl();
}
And asm("hlt") isn't portable.
 
Well, even then, why care about calling convention? Why even return?
 
Well, it should return.
 
_idle_impl:
    hlt
    jmp _idle_impl
 
I don't want it to loop. Just hlt once and then return.
 
@RadekSlupik So you can for(;;) in C++?
 
6:34 PM
That doesn't hlt. It just loops.
 
And yours?
 
It loops and halts every time.
 
Just like mine.
 
@RMartinhoFernandes But yours loops in assembly, mine loops in C++.
idle() (which calls _idle_impl) will be used in several locations, not only in panic().
 
@RadekSlupik Well, it all depends how fast you reach panic ;v)
 
6:37 PM
Well, how is your assembly implementation any more portable than asm("hlt")?
 
I can reimplement it for each architecture and use the same C++ code.
 
You can also reimplement the C++ code.
 
Just assemble and link to a different implementation.
 
Except you get the calling stuff correct for free.
 
asm("hlt") ain't standard. xD
 
6:38 PM
@RadekSlupik It is.
 
Really? :O
In that case…
 
@Potatoswatter : Nooooo
 
@ildjarn lolwut?
 
@Potatoswatter : The answer was good, I just thought the premise that sizeof + ... was canonical is slightly outdated given the c++11 tag ;-]
 
I'm, as I said ealier today, "not on my A-game". I'm half blind, loopy on steroids and cabin fever.
Eh. It's not my best work. I did manage to solve that particular problem, but it didn't make my compiler framework much more elegant. I just have to keep writing some kind of code to justify that I'm not doing it properly and can't go back to work.
 
6:42 PM
@RMartinhoFernandes Heck. You are right.
And awesome.
 
You should check out some of Mr. @RMartinhoFernandes' blog posts. Expression SFINAE can be amazingly elegant (too bad VC++ is still so crippled that all I can do is admire at this point)
 
@ildjarn Yes. I've done things like mentioned in the answer before. I'm not learning anything except how an eye infection + strong eyedrops translate to a brain impediment.
 
:-[
 
Hei guys, me again ^^
This is not a C++ question, related to Python but I think it can be applied to all languages, so more a code-design question..
How do you handle things like this?

        if not (self.min < 0):
            if length < self.min:
                scanner.push(reversed(token), True)
                return

        if not (self.max < 0):
            if length > self.max:
                scanner.push(reversed(token), True)
                return
btw, how to make code blocks? ^^
 
6:48 PM
four spaces each line
 
that had 4 spaces each line O.o
 
Just edit the damn message and click "fixed font".
 
@RadekSlupik Doesn't work when regular text is mixed with code.
 
Ah thanks :D
So, in two cases I have to do the exact same operation. Do I just leave it or is there a way I can merge it?
 
The first thing I will do when my kernel compiles and runs will be adding support for RTTI and exceptions.
 
6:50 PM
possibly not breaking the overviewablity
 
@NiklasR Make a function?
Do you really need RTTI?
 
dynamic_cast is nice to have.
And libcxxrt implements it anyway.
 
Really?
How often do you use it?
I think I would like to work at Microsoft in their marketing department. My job would be to sit in an office and yell "WTF!" at people.
 
@ScottW let me see.
2 days ago was the last commit.
@RMartinhoFernandes maybe a few times.
 
7:11 PM
@DomagojPandža Am I doing something seriously wrong or conversions between XMVECTOR and XMFLOAT3 for instance are just ridiculous shit ? Some API functions work with one, some with another and chaining them involves converting one to the another multiple times ?
 
Portugal is going to pwn Germany tonight.
 
7:27 PM
Totally not what is happening.
 
user406009
7:38 PM
Can anyone give me any hints for this puzzle: code.google.com/codejam/contest/90101/dashboard#s=p2?
 
user406009
The only solution I can think of is to find all "w"s, then find all "e"s following said "w", etc. However I get the feeling this would take forever to build the giant graph.
 
Man, I hate watching MLG tournaments. Their streams always lag.
Blizzcon, IPL, ESL, GSL, NASL, those are always super fluid, but MLG? Nooope, gotta lag.
 
// Is `value` zero-initialized when calling `Test()`? E.g. is `Test().value == 0`
struct Test {
    Test() = default;
    int value;
};
 
Not on my GCC :(
Would Test having another constructor besides the =default one affect zero initialization?
 
7:45 PM
In computer science, the longest increasing subsequence problem is to find a subsequence of a given sequence in which the subsequence elements are in sorted order, lowest to highest, and in which the subsequence is as long as possible. This subsequence is not necessarily contiguous, or unique. Longest increasing subsequences are studied in the context of various disciplines related to mathematics, including algorithmics, random matrix theory, representation theory, and physics. The longest increasing subsequence problem is solvable in time O(n log n), where n denotes the length of the input...
Seems solvable in O(w N log N), where w is the number of ws.
 
user406009
@RMartinhoFernandes Thank you. Never would have seen that by myself.
 
@StackedCrooked Oh wait, no.
 
Oh the joy of linking kernels on Mac OS X…
GNU binutils y u no have ld!
 
8:02 PM
@RMartinhoFernandes 12.6.2, note 5 seems to agree with your original statement
 
@KillianDS "A ctor-initializer may initialize a variant member of the constructor’s class. If a ctor-initializer specifies more than one mem-initializer for the same member or for the same base class, the ctor-initializer is ill-formed."?
That doesn't seem relevant.
 
just a sec
note 8 ofcourse : "In a non-delegating constructor, if a given non-static data member or base class is not designated by a
mem-initializer-id (including the case where there is no mem-initializer-list because the constructor has no
ctor-initializer) and the entity is not a virtual base class of an abstract class (10.4), then
...(2 non-applicable things)...
— otherwise, the entity is default-initialized (8.5)."
ow nvm, I mislooked in 8.5, default-initialization means no initialization for integral types, not zero-initialization.
 
user406009
Shoot, I just had to try the naive approach first, and now the swapping has started. Die python3.exe, die!
 
8:24 PM
All of the Windows Azure SDKs are now developed on GitHub and licensed under an Apache 2 license: https://github.com/WindowsAzure/
 
Oopsula
 
8:36 PM
@RMartinhoFernandes So weird.
They embracing open source.
 
Open $ource.
2
 
I personally think that they are trying to improve their reputation for developers.
In order to attract hire good developers they must appear like a cool place to work.
 
> Developers developers developers developers developers!
 
Btw, is my grammar correct? Or should it be "trying to improve their reputation with developers"?
 
'with' sounds correct, but you should probably care more about 'attract hire' in your second sentence.
 
8:42 PM
That was accidental. Left-over fragments after editing.
 
 
Aaaaarrggg
GNU assembler y u no ELF
 
9:03 PM
GNU assembler, fuck you.
 
Pity that SO isn't really suitable for code review. And the codereview stackexchange doesn't get much visitors.
 
You know,
I HATE LINKERS.
There is no single program that sucks more than the average linker.
binutils from MacPorts includes literally everything but ld, llvm-ld only links Mach-O objects and everything doesn't work.
You know. I'm going to do this in Linux. I need a VM anyway for OS development.
 
sbi
9:23 PM
@RMartinho: :b
 
@RadekSlupik Which means that I will probably be running a VM inside of a VM. >>
 
@RadekSlupik INLINE EVERYTHING!
 
@StackedCrooked I need to have specific things at specific offsets in the binary.
 
sbi
> Dear whoever stole my copy of Microsoft Office - I will track you down. You have my Word. — James Martin
 
@sbi Excellent!
@ScottW There is no more average sucker than the single programmer.
 
sbi
9:34 PM
@StackedCrooked Yeah, just ran across this guy. He posts way too frequently for my taste, so I won't follow him, and, also, it's only 10% of his tweets that I find good — but those I find really good.
@RadekSlupik You wish! :b
 
sbi
12 mins ago, by sbi
@RMartinho: :b
 
b: ?
@sehe what GUI do you use on Linux? Gnome?
 
sbi
@RadekSlupik You stick your tongue out the left side of your butterfly: :P, I do it differently.
 
At least I wear a hat d:p
 
sbi
9:39 PM
@RadekSlupik Yeah, but I can't see which is your hat and which is your tongue lolling out. I'd worry about that, if I was you.
 
Maybe both are hats.
 
Is it possible to install Gnome without all the crap? All I really need is a task bar, a terminal and a file manager.
Emacs, clang and a bunch of linkers.
 
VMware Fusion thinks that I'm an idiot. Look what it set as default settings for the VM.
 
sbi
9:43 PM
"VMware Fusion thinks that I'm an idiot." "I hadn't known VMWare had started to build AI into their products."
 
:P
I hope I can set up SSH so that I can use Linux just for compilation. Would be great.
 
sbi
@RadekSlupik You accidentally a word.
 
mawnin
 
9:58 PM
You know. Giving the VM only 512 MB would have been better idea after all. My whole computer is lagging now.
17 MB of RAM free…
I'll listen to the VMware AI next time.
Restarting Safari freed up half a GB.
 
10:12 PM
Aaaah, Chimay is good.
 
Blue one?
 
Beer is bitter.
 
Chimay is rather sweet actually.
 
@StackedCrooked Yes.
 
Never tried it, but it's probably also bitter.
 
10:23 PM
@RadekSlupik Not all beers are bitter.
 
@EtiennedeMartel but all bitters are beer
 
I see what you did there.
 
noun
1 Brit.beer that is strongly flavored with hops and has a bitter taste.
2 (bitters) [ treated as sing. ] liquor that is flavored with the sharp pungent taste of plant extracts and is used as an additive in cocktails or as a medicinal substance to promote appetite or digestion.
@je4d Guess not :p
 
I guess that guy's British.
Oh, wait, he is.
user image
2
But, yeah, I got Chouffe double IPA as well. And that shit's bitter.
 
@StackedCrooked surely the [treated as sing.] means that the 2nd definition is inapplicable in the context "all ... are"
</pedant>
@EtiennedeMartel indeed I am
 
10:31 PM
Budweiser recently released a new product here: Bud Light Lime Mojito.
I weep for the future of mankind.
 
0
Q: C++: Which operation is faster?

rolandbishopA really basic question; Considering an integer value, we would like to check that is not equal to 0. Using "!=" or ">", which one would be more efficient to use in C++?

geez
 
I thought != was a very fast operation
 
It's not relevant.
Trust your compiler.
 
Well people used to write loops backwards because of it
 
If > is faster than !=, the compiler will use it whenever it can.
 
10:34 PM
Trusting your compiler to optimize is stupid
Writing micro optimizations is usually more stupid though
 
@cicada hmm I copy pasted exactly, I get 3 errors ; expected, I tried to place semiclones but no success! — Sean87 5 mins ago
> semiclones
 
Yeah you know.
 
At first I read that as "semicolones".
 
Half clones.
 
And I thought "My gawd, is that Spanish?"
 
10:35 PM
Should probably try placing fullclones instead
 
Semiclones = offspring
 
Works twice as good
 
IHalfCloneable
 
Derived concrete classes must implement T clᵔ().
 
object.SemiClone()
 
10:37 PM
n
 
Returns an object that was half cloned. You're on your own to fill the other half.
 
Half? Wouldn't that be a hemiclone?
 
T SemiClone() {
  T m;
  memcpy((void*)&m, this, sizeof(*this) / 2);
  return m;
}
3
 
How cruel.
 
it's faster
 
10:39 PM
 
#define sizeof(x) (sizeof(x) / 2)
@CheersandhthAlf Depends; alignment.
I guess. Maybe.
 
Brewers are really trying hard to make crappier and crappier stuff.
@RadekSlupik Wouldn't that cause an infinite loop of macro resolution?
 
@EtiennedeMartel Macros don't do recursion. I guess it works.
 
Macros can't be recursive
 
10:41 PM
in theory
 
Ah. Carry on then.
 
but in practice, that's another matter
 
Although #defineing keywords is UB AFAIK.
 
Actually, no, don't carry on. Macros are evil. They eat your soul.
 
Boost.PP is magic.
Magic ponies.
And a lot of confetti.
 
10:42 PM
@RadekSlupik Only if they're #defined when you include a standard header
 
@CatPlusPlus Don't forget moon dust.
 
no, the stuff down in Boost Parameters is magic
i don't know how it works
 
No, you can't define reserved words.
 
@Pubby Oh ok.
 
That makes the universe explode.
 
10:42 PM
Heh, I just typed Poost.BB
 
it's undocumented
 
@CatPlusPlus Really? You can't #define true rand()?
 
can you do this?
#define sizeof1(x) (sizeof2(x) / 2)
#define sizeof2(x) (sizeof1(x)/2)
 
10:43 PM
Not really no/
 
@Cat is the coolest cat around.
(He's also the only one)
 
@NegativeZero sizeof1(foo) will expand to sizof1(foo)/2/2
 
I hate installers that are done at 50%.
 
10:44 PM
Damn, that Chimay is starting to kick in. Drinking a pint might have been too much.
 
@RadekSlupik You probably have forgotten about win95
Instantly goes to 99%
Stays there for hours
 
PlayStation is always done at 30%.
 
most ms installers hang for a while
ime
 
Installers suck.
Download and run ftw.
 
and some free software publishers require an installer. no download and run!
 
10:46 PM
Hmm. There's about half a pint left. Guess I have to empty that fucking bottle.
 
hey, is ? evaluated at runtime with constants?
 
probably not
i can't remember any guarantee that it will be evaluated at compile time, though
 
I guess it would depend on your implementation. But if the boolean part is a constexpr, I think your compiler would be stupid not to optimize it.
 
the question is whether ? can be used in an expression giving e.g. size of array
 
compilers support constexpr?
 
10:48 PM
@stdOrgnlDave clang.
 
@CheersandhthAlf What question?
 
what guarantees you have about compile time evaluation
 
none!
mwuhahahha
 
daknok is not in the sudoers file? What the fuck?
 
so
template <const int a, const int b> struct tmax { enum { value = (a > b) ? a : b }; }
should work
 
10:50 PM
Fuck Linux. Piece of shit.
4
 
True dat.
@CheersandhthAlf None, I guess. But that doesn't mean you shouldn't try to micro-optimize the shit out of everything.
 
My kernel doesn't even compile and it's already better than Linux.
 
you apparently can't use const int arrays at compile time?
 
I think I'm drunk.
 
10:53 PM
I'll just use Mach-O for my kernel.
 
Nah, I'm kidding, I'm a drunkard, I can't get drunk.
@Cat, I still haven't heard your sexy voice on Mumble.
 
GCC & MSVC y u no let me use const int[] at compile time :-(
anyone?
 
It's not a constant expression.
You can only use constant expressions as template arguments of type const int.
 
indeed.
how does one make an array a constant expression.
 
I think you can't, not sure though.
 
11:01 PM
that is very annoying
I will ask it on SO and look dumb
 
I hope GRUB understands Mach-O binaries.
 
11:12 PM
0
Q: Compile-time array constants

std''OrgnlDaveI seem to be missing something rather fundamental. I'm trying to use const array members at compile-time. const int list[3] = { 2, 5, 7 }; const int a = list[2]; // this doesn't error? template<int N1, int N2> struct tmax { enum { value = ((N1 > N2) ? N1 : N2) }; }; const int b = tm...

with that, I'm out
thanks for all the non-help :-D
 
I'm wondering what Doxygen will do if I have multiple definitions of the same function.
Hmm it will pick the first one it finds.
 
We're watching Cube trilogy. It does not make any sense.
 
As the name suggests…
 
11:28 PM
It's weird.
 
Cube quadrilogy would make more sense.
 
11:39 PM
Fucking Microsoft fuckers don't plan to put constexpr in VS2k12, FUCK THEM
 
Yeah.
YEAH.
 
GitHub y u no update language statistics.
 
11:54 PM
Hey @CatPlusPlus I found your twin.
Tom, San Francisco, CA
2.5k 9 26
 
Old. Slowpoke.
 

« first day (602 days earlier)      last day (4361 days later) »