« first day (674 days earlier)      last day (4289 days later) » 

12:00 AM
but 8-15 kind of implies that they're an extension on top of the 8 "old" registers
which they are
 
yeah. i mean, the extended originals should be r0 through r7
it's silly to write e.g. rcx and then e.g. r8
 
that would be confusing though
since they still overlap with the old ones
 
r5 <- which is it?
 
it's easier to remember that the low 32 bits of rcx can be accessed as ecx
than trying to figure out which # r-something corresponds to the 64-bit version of ecx
 
anyway, where on Earth is assembler that understands Unicode?
 
12:02 AM
lol
 
it's not smooth ride to have to link with C module that just defines Unicode string literals
 
Ell
@R.MartinhoFernandes well eax doesn't resemble "general purpose register" to me. ...That's not what it is, is it?
 
@ell rax extends 386 eax which extends 8086 ax which sort of represented earlier 8080 8-bit A and B register pair, IIRC.
 
You have AH, AL, AX, EAX, RAX, BH, BL, BX, EBX, RBX, ... there's a pattern.
 
The i8080 had ancestor 4004, which was first commerical microprocessor, it was 4-bit. :-)
 
12:06 AM
The A and B in the names are meaningless, which is good: they're general purpose, you assign the meaning you want.
 
I used the i8080 in high school (well it was (probably) an i8085).
 
I used the i7 in high school.
xD
 
Ell
me too :D
 
@R.MartinhoFernandes well not quite. from olden days "A" was short for "accumulator". then B followed logically, and so on, although the 8080 just had A, B, C, and D, and then H and L (high and low, a register pair)
 
Ell
nighty night all
 
12:11 AM
Have fun.
 
What would be the fastest way to parse a two-digit hex string into a uint8_t? Lookup table?
 
That's what I'd do.
I don't think adding branching all over will help.
 
auto vals[sizeof(char)] = { ..., 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ..., 10, 11, 12, 13, 14, 15, 16, ..., 10, 11, 12, 13, 14, 15, 16, ... };
Lookup table. :)
 
what kind of char has a size that fits that list?
 
You can use TMP to fill the zeroes statically easy.
 
12:19 AM
The problem is that you need two digest for an octet. So you first look up the first digit, multiply the result by 16 and then look up the second digit and add it to the first one?
 
@RadekSlupik sizeof(char) is wrong.
@RadekSlupik Yes.
@melak47 hehe.
 
vals[str[0]] * 16 + vals[str[1]]
@RMartinhoFernandes ugh. auto vals[~'\0']
 
Even if that would work (i.e. char was unsigned), it would most likely be 255, but you want 256 for the size.
1 << CHAR_BIT.
 
12:22 AM
Yes. I want 256.
Aahh clever.
You said generating it using TMP huh?
 
Xeo
1
Q: C++11: Calling a function for each variadic template argument and an array

Andrew Tomazos - FathomlingSo I have some type X: typedef ... X; and a template function f: class <typename T> void f(X& x_out, const T& arg_in); and then a function g: void g(const X* x_array, size_t x_array_size); I need to write a variadic template function h that does this: template<typename....

Fun with templates~
 
Filling the zeros is not needed by the way. Garbage value is fine.
 
@Xeo Saw that earlier. Indices trick again. Boring.
 
Xeo
@R.MartinhoFernandes Meh, can be done other ways though :/
Btw, the lounge wiki page on the indices trick has an error: template <typename N> build_indices
 
Fix it. I'm busy :P
 
12:24 AM
Is there some way to have an array and do array['a'] = 10; array['b'] = 11; at compile time?
 
@RadekSlupik That's why I mentioned TMP. Gimme a minute and I'll have an example ready.
 
Xeo
@R.MartinhoFernandes Sorry, gotta go to sleep :)
 
@RadekSlupik you could use std::map :p
but compile time..
 
Ahh. Template specialization.
@melak not O(1).
 
yeah :p
 
12:27 AM
template<char c> constexpr int foo() { ... }; specialize for 'a', 'b', etc…
 
Xeo
That's... way too much effort
 
Lol.
I should go to sleep.
 
array[] = { foo(0), foo(1), foo(2), … } xD can be generated using TMP.
 
@RadekSlupik Gosh.
 
Xeo
@RadekSlupik btw, should 'a' be your first index (aka your base)?
 
12:30 AM
@Xeo huh? I want to map both A and a to 10, B and b to 11, etc.
 
Xeo
If yes, you need arr['a' - 'a'] = 10, arr['b' - 'a'] = 11, ... (or a function)
 
So if you do vals['a'] you get 10.
 
Xeo
Aw, now my fingers are itching to write this
 
O(1) lookup. The array is as big as the number of values a char can hold.
 
Xeo
But the robot's already on the case :(
And I really gotta get some sleep
 
12:32 AM
Anything but indices '0' ~ '9', 'a' ~ 'z' and 'A' ~ 'Z' can be garbage. That's fine.
 
Xeo
@R.MartinhoFernandes plink me when you're done so I can see it tomorrow, please.
 
Use a hashmap.
 
Xeo
Why do you want that, btw?
 
I want to parse two-char hex strings into octets.
 
This inventing silly things thing is silly.
 
12:34 AM
@RadekSlupik what about a simple sscanf_s("A", "%x", &intvalue);for each digit
 
Lookup table is tehh fastezzzeeedddd O(1)zz OMG
 
where "A" would be the digit :p
 
Even O(n) hashing with 1 character is O(1).
So use a damn hashmap.
 
or sscanf(instring, "%x%x", &outdigit1, &outdigit2); return 16*outdigit1+outdigit2; :p
 
Or, you know, std::stol("AB", nullptr, 16)
Or possibly stoul.
 
Ell
12:42 AM
Or maybe even stool
 
Or a lookup table.
 
the LUT would be abominably fast
 
If you're crazy, and like to waste time on insignificant shit.
 
very true
 
12:43 AM
Generating the table in other code and just pasting it would be much saner (after all it won't ever need recomputing).
 
Robot just in time with demonstration of "crazy".
 
@CatPlusPlus :)
 
he's a JIT
 
I have an octree with ~30k nodes. If I delete the root node (which in turn deletes every other node) during runtime it happens instantly. When I close the program it takes over a minute to delete the entire structure. When I run the profiler to see if it is actually deleting the tree that is causing the problem the program closes instantly. Is there anything that obviously sticks out as to why this is happening?
 
UB
 
12:48 AM
Program randomly acts crazy for no apparent reason => UB.
 
What is the easiest way to find out where the UB is happening?
 
there really isn't
compile with all warnings, run under debugger, if nothing shows up, then you'll have to start separating out classes and testing them individually
 
Found it. I remembered roughly when it started happening, it's not the tree that's the problem. Deleting my window is.
Thanks :P
 
Clang has a nice -fcatch-undefined-behavior flag which adds checks at the expense of performance..
 
Ahh, I'm using visual studio. I'll look into whether or not that has the same kind of feature :)
 
12:54 AM
it has a lot of such checks when you run in debug mode
 
ARgdhdkhf. Compile, you freaking piece of garbage! Compile, dammit!
I'm running around in circles.
 
lol
 
I'm fighting with boost range again.
I need a different approach.
 
1:09 AM
I wonder how LLVM's linker is coming along
 
@RadekSlupik so, are you parsing octet pairs yet? :)
 
1:26 AM
well
now that LLVM is finally mature enough, I might go back to working on Wide
 
GGG
1:56 AM
son of a bitch
NULL is just a macro for 0?
no wonder I couldn't figure out what type it was =p
 
lol
most people use nullptr these days
 
hey i have question
im learning python and trying to convert a small piece of C++ to python
 
lol
ok]
 
@GGG LOL nice.
 
GGG
2:05 AM
@DeadMG thanks, was just looking at that... really I need a type to represent a null value, not a null pointer... I might just make it an empty struct or something
 
@GGG boost::optional?
 
@GGG well, nullptr has its own type.
 
@GGG boost::optional is pretty much that.
 
GGG
i need a function signature that takes a type that represents a null value
@SamBloomberg that could work then
 
@GGG I believe it is nullptr_t (you need C++11 though)
 
2:07 AM
Wait, wait. Why do you need a null value?
 
@SamBloomberg std::nullptr_t.
 
GGG
yeah I think this might end up being C++11 only for now
 
what DeadMG said
 
GGG
@EtiennedeMartel JSON tstuff
 
@GGG Can't you just use a JSON lib?
There are like a million billion available.
 
2:07 AM
Maybe there should be a million billion and one :P
 
GGG
@EtiennedeMartel there's like 15 or so that I found, I'm making one as a learning excercise
 
Not a bad idea. Plenty to learn from it.
 
@GGG Oh, right. Then I would probably make an empty singleton class.
Or just go with nullptr_t.
 
GGG
I think I'll do an empty class or struct for now so I can retrofit it for older C++ if I want to later
 
Not a bad plan
 
GGG
2:10 AM
Yeah I haven't looked at the other libraries yet, going to do it after I finish and see how much different they are :)
 
Meh. It's not like getting a new compiler is hard.
 
GGG
^ good point
 
I wouldn't target C++03 unless you already have a bunch of code written for it.
 
GGG
and learning to do stuff the old way might not be particularly useful
yeah
i think you're right
 
Most modern compilers support a good portion of C++11
And writing for legacy is a pain
 
2:11 AM
Actually, only GCC and Clang.
MSVC is crap in the C++11 department.
Although it does support the most important parts.
 
GGG
initializer_list?
 
Thats what I mean
yeah... hopefully msvc will get better with all that in the future
 
GGG
that's the big thing I want
 
gunna have to look that up. i don't know if it supports that off the top of my head
 
@GGG According to this, no.
 
2:14 AM
man, not even in vs11/2012? that sucks
 
These guys improve their standard support only when they're not busy making a non-standard thing.
Namely, WinRT and C++/Cx.
 
true
so... anyone working on something interesting?
 
GGG
@EtiennedeMartel yeah I knew there's a reason I was holding off
good old MS, just like the browser world
 
Still, I wonder if it's possible to write a JSON lib without resorting to a Java-style single base class.
 
GGG
2:20 AM
you know what, I might do C++11 and then do ifdef'd macros and hacks to make everything work exactly the same way under VS
@EtiennedeMartel I just use a really crude variant that has fields for all the different types it might need to store
it wraps vector and array so you can nest stuff
 
@GGG You should try boost::variant.
 
GGG
I know, I will
but I want to write my own first
well I did already, and it seems to work
 
GGG
just want to fix up null and come up with some good initialization syntax for object and array literals
I have a Q for it here actually - stackoverflow.com/questions/12024434/… source is linked
 
2:23 AM
@GGG C++ doesn't have any good initialization syntax
 
GGG
slightly old version
@DeadMG it's decent in C++11
I think I can actually duplicate the same syntax with macros
might need an extra set of parens or something
 
@GGG He's notorious for his ridiculously high standards. I don't think he even finds brace initialization "decent".
 
GGG
var jsonCrap = {1, true, "three"}; looks decent to me
or even
var jsonCrap = array{1, true, "three"};
or something along those lines
 
Our standards ain't high, it's your standards that're very low.
 
@CatPlusPlus Oh, you.
 
2:27 AM
brace initialization doesn't really nest very well.
the tuples I have in Wide are far superior in many, if not every, respect
 
Yeah, I'm starting to think that you might be biaised.
 
well, it's kinda difficult to suggest otherwise
can be perfect forwarded properly, unlike initializer lists
has some other nice forwarding-related behaviour
can be nested arbitrarily
 
GGG
what is Wide
 
language I am building
 
GGG
ah
 
2:29 AM
they are real expressions that have real types
 
GGG
	var myObject = (object){
	  {"lmno", 8},
	  {"false", 1},
	  {"nested", (object){
	    {"a", (array){ 4, 8, 16 }},
	    {"b", "zxc"}
	  }}
	};
 
Yeah, I believe you. I'm sure it's very good. But while I wait for an actual implementation, then I'm stuck with C++.
 
GGG
it's not horrible
 
true
but since LLVM popped an actual linker (and it might even work)
then I'm resuming work on Wide
 
However, the samples you've shown all look more verbose than C#.
 
2:31 AM
hmm
I have changed a lot since the language's initial concepts
 
give a sample task which you think is quite verbose and I'll see about a sample
 
GGG
Bubble sort?
 
Just so you know, my style of C# abuses var, object initializers and LINQ, and tries to compact as much as possible in as little code as possible.
 
in Wide, var is the default.
 
GGG
2:32 AM
LINQ is pretty cool actually
 
I'm starting to think that functional constructs are inherently less verbose than imperative ones.
 
also Wide has a LINQ-style Standard lib
@EtiennedeMartel They are, because imperative code can't re-use sections of code that functional can.
 
GGG
Heh, I want to see some examples
 
in some cases
 
@DeadMG Isn't functional programming a branch of declarative programming?
 
2:34 AM
no.
 
functional programming is little more than imperative programming, except they have handy syntactic shortcuts for lambdas
 
I'm pretty sure it's more than that.
But I'm not an expert. I wonder what @CatPlusPlus thinks.
 
there's nothing non-imperative about immutability, purity, or garbage collection.
 
Functional programming is closer to declarative than imperative.
 
2:37 AM
nah
 
You describe high-level data flow, not the sequence of operations.
 
when you write a functional program, then it's still a list of instructions. Those instructions may be expressed in a somewhat different way, but it's still a list of instructions.
@CatPlusPlus Lazy and declarative are two quite different things.
 
GGG
@DeadMG Couldn't you extend that to say that if you write in a declarative style, it's still just a list of instructions by the time you compile it?
 
Who says anything about lazy?
 
@GGG Not really.
 
GGG
2:39 AM
I'vwe always thought of functional programming as being closer to declarative
 
@DeadMG Looks to me like you never used an actual functional language.
 
Of course not, they all use evil garbage collectors.
 
I had Haskell inflicted on me at university just as much as PROLOG
 
GGG
it's a bunch of functions, usually with nested scopes and few side effects, function bodies can easily be changed out
 
@GGG But the program is still fundamentally composed of function bodies. And those bodies are instructions.
 
GGG
2:41 AM
same with declarative, it's just more organized
 
not really.
 
That's like saying XAML is an imperative language because the tags are instructions for a parser.
 
GGG
in there somewhere you have to have instructions that actually do stuff
 
@EtiennedeMartel It's difficult to describe XAML as an imperative language if it's not Turing-Complete, no?
 
2:42 AM
@GGG Actually, you don't.
 
@DeadMG Indeed. But I was just making a strawman out of your argument.
 
GGG
hmm, you mean for something like XSLT?
I can't really picture an example of that
 
@EtiennedeMartel Well, I don't think it's strawman at all. They are instructions for a XAML interpreter.
and if XAML interpretation was Turing-Complete, then I wouldn't object to calling it an imperative language (if used in that style)
 
And SQL is a list of instructions for SQL parser. There's actually no declarative language.
 
GGG
yeah I don't think so either
it's just a style
 
2:43 AM
I thought the whole distinction between imperative and declarative was that in the former you specified how and the latter you specified what.
 
GGG
the instructions are in there somewhere
 
@EtiennedeMartel That's a quite shitty distinction.
for example
 
@GGG And it's all electrical current in a processor.
 
There are no languages, it's all a lie.
 
@CatPlusPlus ITT: @DeadMG argues about words.
 
2:45 AM
We're also a figment of imagination of one of those two people who actually are on the Internet.
I think it's too late to go to bed.
 
@CatPlusPlus The universe is a figment of its own imagination.
 
Hey, Jerry is alive.
 
@EtiennedeMartel A Coffin that's alive? Sounds a bit scary.
 
I will show you an example of what I mean
give me a sec
 
But, wait, is @DeadMG seriously changing definitions about whole classes of programming languages just to prove that functional programming isn't all that special?
 
@EtiennedeMartel Voltages anyway. The basic intent of CMOS is to keep actual current flow as minimal as possible.
 
suddenly, by using an abstraction, my code becomes magically declarative!
@EtiennedeMartel I use definitions that make sense. If the traditional ones don't make sense, then replace them.
 
@DeadMG Oh, hey, nitpicking.
 
@EtiennedeMartel Not really. There's nothing more declarative about SQL than C++.
all you'd have to do is invent a couple temporary variables, maybe.
 
So, what's your point? That Haskell isn't all that good?
 
2:50 AM
no
my point is that something like PROLOG, which is declarative, is very different from Haskell, which is much closer to imperative.
 
Hint: std::sort is functional.
All std algorithms are.
It's always about abstractions.
 
@CatPlusPlus It happens to be in this instance. But my point would be exactly the same if I'd simply written a bubble_sort(int* begin, int* end) and called that, instead of std::sort.
 
@CatPlusPlus's got a point. Maybe some imperative languages have functional constructs. Doesn't suddenly make them functional.
I mean, C# isn't a functional language despite LINQ.
 
@CatPlusPlus I can't really agree. Though it's fairly high level, it looks pretty much imperative (and since it's templated, at least somewhat generic).
 
It's not about what's inside, but how you use it.
 
2:52 AM
I'll give you that std::sort is, in fact, functional.
 
Ranges show it better, because they're more composable.
 
but it's not relevant for this specific example
 
When you write C# or C++, you're not thinking about functions (in the mathematical sense) as the base programming construct.
 
I could write a completely imperative function and the point would be the same
 
The internals are not relevant to the whole distinction between functional/declarative and imperative.
 
2:53 AM
What is your point, and what sparked this whole debate?
 
my point is, functional is a lot closer to imperative than declarative
 
Haskell is internally all about mutation, that doesn't make it non-pure or imperative.
 
if you consider using a language like PROLOG and contrast with Haskell and C++, then Haskell is one hell of a lot closer to C++ than PROLOG.
 
Not really, but whatever. I'll try to get some sleep anyway.
 
GGG
In computer science, declarative programming is a programming paradigm that expresses the logic of a computation without describing its control flow. Many languages applying this style attempt to minimize or eliminate side effects by describing what the program should accomplish, rather than describing how to go about accomplishing it. This is in contrast with imperative programming, which requires an explicitly provided algorithm. Declarative programming often considers programs as theories of a formal logic, and computations as deductions in that logic space. Declarative programming ha...
fuuu
click it
 
2:59 AM
Anyway, I'm gonna get some sleep.
See you guys in eight hours or so.
 
nn
 
GGG
later
 
@EtiennedeMartel G'night.
 
GGG
Anyway the most imperative style I can think of would be like BASIC or assembly
the most declarative, probably XSLT
I guess functional languages don't seem similar to either really
 
PROLOG is the only language I know of that I'd really class as declarative
 
GGG
3:03 AM
I don't know anything about PROLOG, always thought it was a lisp-ish thing
 
no
if you have PROLOG and you do like, z = x + y; y = 5; prolog will spit out every possible combinaton of z and x that make that thing true.
 
GGG
oh wow
that's pretty cool... doesn't haskell do something like that
 
no
 
GGG
hmm something else does I think
or maybe I'm thinking of prolog
this is probably what I was thinking of - darcs.haskell.org/nofib/real/prolog/Examples
yeah I did play with prolog a bit in this haskell interpreter, it's pretty cool
man it's weird though, it's like you're writing stuff that is purely declarative, but it feels like you're writing it in an imperative style
because it's a bunch of one line expressions
pretty unusual
 
@GGG It is, but a lot of the difference is the nature of those expressions themselves. For example, when I say x=y in most languages, I'm assigning the value of y`y to be stored in x. If I do the same in Prolog, I'm asserting a fact -- saying that x does equal y, so if (for example) something else says that y has the value 5, then it knows x must also have the value 5 -- but if there's nothing to constrain the value of y, then it doesn't constrain x either.
The other tricky part is that assertions can work either direction, so given x=y, it can figure out the value of y based on a known value for x, just as easily as figure out the value of x based on y -- and in either case, it can also work with constraints on values, not just values that are known (i.e., fully constrained).
 
GGG
3:16 AM
Yeah I was just wondering how assignments worked in Prolog
It's too late to start looking at this tonight, I know I'll be hooked and want to use it for something
 
3:43 AM
I'm sure pros code in vim + make +gcc, but what options are out there for Windows without installing cygwin?
Good options, I mean.
 
Visual Studio
 
. . . Is that my only good option?
 
yep
 
I like to support Microsoft as little as I can.
 
well, unfortunately, they make the best C++ tools around
 
3:48 AM
Okay.
I wonder if I can get it through the MSDN alliance at school.
 
yes, you can.
Express is free to everyone. Professional is free for academic use for anyone with an academic email address, through Dreamspark. Ultimate is free for academic use for anyone at an institution that pays for MSDNAA.
 
'for academic use' <- how liberal are they with that? :)
 
as long as you don't start selling the code for moneys, you're probably good.
remember, they probably get millions of these downloads, they can't go checking every single one for the tiniest infractions
besides, Visual Studio is the best C++ tools on any operating system, so
 
Does it have libs for std::thread and friends or do I need to use boost or something else?
I guess I could probably Google that.
Thanks.
 
it's got something much better
VS2012 has std::thread and friends, I think. But nobody would ever want to use it over the PPL.
 
yes
 
0
Q: KDevelop4 Debugging {...} cannot be unfolded

Neel BasuI am debugging with KDevelop4 which is not showing Types always in its variables window and also Its showing {...} instead of unfolding the data. Is there any way to unfold ? and see types of all variables ?

 

« first day (674 days earlier)      last day (4289 days later) »