« first day (517 days earlier)      last day (4414 days later) » 

7:00 PM
But I was more thinking in the direction of giving it a range of allowed values. integer<initial_value<0>, allowed_range<0, 20>>
With runtime checking.
But that's probably overengineering.
 
@StackedCrooked Different use case, IMO.
 
Yeah.
 
ranged integers have plenty of uses beyond simply ensuring that they're always initialized
 
Boost always comes up with these clever things:
class initialized_value_t
{
  public :
    template <class T> operator T() const ;
};

T var = initialized_value ;
 
7:03 PM
eh, you need more than that :P
for example, op=
and what about op T&?
 
@DeadMG yeah, I was like... that can't work...
@StackedCrooked if you're going to initialize it with initialized_value, you haven't really saved yourself anything
 
@DeadMG initialized_value is yet another slightly different use case. It allows an alternative syntax to T var = T();
 
oh
how curious
yeah, you could always do auto&& var = T(); :P
 
This is fun stuff.
 
Not on a member.
 
7:06 PM
the robot has awakened.
 
@DeadMG What is the lifetime of var here?
 
@StackedCrooked Bound to an rvalue reference, so extended.
 
@StackedCrooked magic
 
Not on a member.
 
@RMartinhoFernandes So it obeys the same rules as the "most important const" trick?
 
7:07 PM
Sorry, dunno what that means.
 
Binding rvalue to const reference.
 
Anyway, now you can just do T x {}; and not bother ({} is value-init, doesn't call an initializer-list ctor... unless there's no other option, of course).
 
std::string get_string();

const std::string & s = get_string();
 
@StackedCrooked Oh, yeah, it's the same.
 
@RMartinhoFernandes I still haven't gotten used to the {} notation yet.
It wreaks havoc on the neuron orderings in my brain.
 
7:11 PM
@StackedCrooked I only plan on using {} for initializing vectors and lists and such, other than that, I think it just confuses constructors. (until such time as someone convinces me otherwise)
 
What about aggregates?
 
@RMartinhoFernandes oh yeah, those too
@RMartinhoFernandes basically, I do not intend to use {} to call non-initializer-list constructors
 
{} brings aggregate-like init to everyone.
 
@RMartinhoFernandes sure, but using it for vector(count, value) seems misleading
 
@MooingDuck huh?
 
7:14 PM
@rubenvb there was a question a few days ago who wanted to construct a vector with two ones in it, so he called std::vector<int> myvec{2, 1}; and said it was misleading to say that {} were the universal replacement for constructors.
 
And an empty {} is a nice, clean, universal way of saying "value-initialized", which was missing from the language.
 
@rubenvb std::vector<int> v(2, 3); // {2, 2, 2} or {3, 3} ?
It's a little confusing imo.
 
@StackedCrooked that second one should be {2, 3}
 
@StackedCrooked no, not really. That's the difference between a constructor call and an init-list.
 
@RMartinhoFernandes true, I don't know if I'd use that or not. I probably would.
 
7:16 PM
@MooingDuck No, it's confusing even without initializer lists: it's two threes, or three twos?
 
4
Q: C++11 initializer lists + uniform initialization

Robert MasonI've been playing around with C++11 for the past few days, and I came up with something strange. If I want to uniformly initialize an int: int a{5}; But if I do the same thing to a std::vector: std::vector<int> b{2}; Does not construct a two element array, but rather an array with on...

 
@MooingDuck I know, I answered that.
 
Indeed my example was simply about the vector constructor without using initializer lists.
 
@RMartinhoFernandes so you did. I even see I upvoted you :)
 
Hmm. Init-lists don't replace constructors. They replace the trivial ones.
 
7:18 PM
My point is, to avoid that confusion, I plan on using {} only where I can't use ().
@rubenvb he's right that there's a lot of misinformation about them though.
 
not in my head.
 
@rubenvb no, but until that question, I've never heard anyone mention that we might still use () once we had {}. Nobody mentions it, so it's easy to misunderstand, and think that it's a replacement but better.
 
Well, calling it "uniform initialization" is a bit misleading.
 
@RMartinhoFernandes that too
 
yeah, I had that ambiguity problem a lot. Now I like init-list initializaton better
that's what the Standard uses IIRC
 
7:21 PM
I gave up on that and started using the proper term (list-initialization) a while ago.
 
hey guys
anyone up for a quick newbie question?
 
omg! I just discovered that VC++ accepts identifiers with "$" in #define, like #define $foo
 
always up for newbie bashing
 
@hanleyhansen perhaps :) let's have it
 
@rubenvb It sucks. The fact that initializer_list can't forward moves is incredibly annoying.
 
7:23 PM
@RMartinhoFernandes won't that kind of stuff be optimized by the compiler anyways?
 
@rubenvb It won't compile.
 
Issue is related to what we discussed before. I SSHed into my server and i ran the application manually and it returns a segmentation fault. I'm not a C++ guy. Someone mind pointing me in the right direction?
 
@hanleyhansen run your program through gdb, get a stacktrace, fix the bug.
 
@hanleyhansen does it run at all on that particular box?
 
Do you have access to gdb or something on the server?
 
7:24 PM
Reeks of missing/incompatible libraries
 
I think ruben meant that you can pass by value instead and allow the compiler to optimize the copy away.
 
@StackedCrooked You can't copy unique_ptrs.
 
@rubenvb not likely a programming bug in this stage; more like dynamic linking problem
 
@sehe It was running earlier. The binaries haven't changed. All i did was re-upload it.
@rubenvb what's gdb?
 
@hanleyhansen Using FTP?! Use passive FTP :)
@hanleyhansen a debugger
 
7:25 PM
@sehe ah, ok, I missed stuff. Still, gdb saves the segfaulting day.
 
@rubenvb Not if the binary is simply corrupt :)
 
@hanleyhansen GNU debugger. Available on all Linux distro's.
 
maybe got corrupted during the upload? Do the md5s match?
 
@CollinHockey my bet: no
 
@sehe I am assuming everything like that has already been checked ;-)
 
7:27 PM
@hanleyhansen and BINARY ftp too, was what I intended to say :). In text mode will corrupt binary files
 
@CollinHockey Interesting. I'll try uploading again.
Should I compress in a folder first then upload?
 
@hanleyhansen Better yet: test the checksums first. That way, you actually know something
 
md5sum <filename>
 
@hanleyhansen Just upload it. Whatever tickless your fancy. Are you using FTP?
 
But shotgun debugging is so cool!
 
7:28 PM
@RMartinhoFernandes sigh and lol
 
@sehe Yes I am
 
@hanleyhansen So did you enable binary transfer mode?
It's a classic mistake when using ftp
 
I've known text mode will screw with a binary, is it a line-ending thing that does it?
 
@CollinHockey yup
 
@sehe Yes i did. Someone else uploaded before me and i'm pretty sure they didn't. I downloaded and then re-uploaded. Makes a lot of sense.
 
7:29 PM
@hanleyhansen Indeed. Now, I'd make sure by running a checksum, but my money is on corruption by ftp transfer :)
 
Meh Wikipedia changed page structure and now my plugin is broken again.
 
@rubenvb don't:
7 mins ago, by hanleyhansen
anyone up for a quick newbie question?
@StackedCrooked what plugin
 
@StackedCrooked Ah, Aime Rantings :) Sweet, you mentioned that before
 
Xeo
Another failed benchmark \o/
0
Q: unordered_map extremely slower than hash_map

VargasI've done a simple test using the default hash implementation for int keys. Here's my test code: #include <hash_map> #include <map> #include <iostream> #include <vector> #include <tr1/unordered_map> using namespace std; using namespace __gnu_cxx; int main(int arg...

 
7:32 PM
Awesome. Thanks guys!
 
@StackedCrooked Get to work fixing it!
(I don't use it btw, so don't worry about me)
 
@RMartinhoFernandes I'm already on it!
 
Xeo
Now I need another close reason: "Closed as FAIL"
 
This is the culprit: if (document.URL.search("Category:Anime_of_") !== -1)
Wikipedia renamed it's pages from "Category:Anime_of_2012" to "Category:2012_anime"
I should use a more flexible pattern matching regex.
 
@Xeo he already defailed it.
 
7:37 PM
@hanleyhansen Worxit now?
 
Xeo
No he didn't.
The is are still uninitialized.
 
@sehe Yes thank you
 
@Xeo in the comments at least, the benchmark at least.
 
@rubenvb Nothing was defailed. And there's nothing to defail there: the proper benchmarks show no difference.
 
Xeo
That wasn't the OP :P
 
7:37 PM
@rubenvb It was Kerrek.
 
oh, lol
nvm
 
The question only exists because of the fail.
 
Anyone in here develop on a Mac?
 
@hanleyhansen Good to hear
@hanleyhansen A few, IIRC
 
@sehe Is that popular amongst C++ developers?
 
7:41 PM
@hanleyhansen the world runs on windows
 
@hanleyhansen since llvm, I guess
 
Ok just curious
 
@MooingDuck except the supercomputing world :)
 
I'm going to NARQ it, and then delete, per OP's request. If anyone cares to follow.
 
Xeo
That some people never check their benchmark code if the outcome isn't as was expected..
He already did.
 
7:42 PM
Oh nice.
I thought you couldn't delete if there were answers.
 
@RMartinhoFernandes my thought too
 
(And someone posted something silly.)
 
Xeo
No, only if you have an accepted answer IIRC.
 
@RMartinhoFernandes ((and it wasn't even the question))
 
@Xeo That would be stupid: unaccept+delete.
Maybe it's only not allowed if there are upvoted answers.
 
Xeo
7:43 PM
/shrug
 
13 hours ago, by Cat Plus Plus
http://nedbatchelder.com/code/cog/
@CatPlusPlus ^^ thanks a bunch, that (cog) is a neat tool to not have to write myself
 
7:58 PM
@Xeo Hammer is fail, it benchmarks so much slower at removing screws than Screwdriver.
 
sbi
@sehe Indeed! Damn. Thanks.
 
8:14 PM
I've never come across a situation where I needed to generate c++ code.. maybe pre-generate tables?
 
Clang!
 
Hmm, 6 upvotes for silver badge.
Time to camp that tag.
 
sbi
@CollinHockey Writing a Your-language-to-C++ compiler? :)
 
Why would anyone want that?
 
8:23 PM
I was thinking specifically in reference to cog, but yes
 
sbi
@RMartinhoFernandes Note the smiley.
 
LLVM has a C backend. That technically qualifies as C++.
It probably will be C++ compliant C anyways.
 
C++ is not low-level enough to be used directly for easy machine code generation, it doesn't have a highly populated tool ecosystem, ...
@sbi Oh, damn.
 
sbi
OTOH, writing header files from declarations in some declarative language (IDL?) shouldn't be that uncommon.
 
Oh, that's that COM thingy, right?
 
8:25 PM
the lights outside my office are flipping out
 
Time to go home?
 
sbi
@RMartinhoFernandes I think IDL stands for Interface Definition Language. I just took it as an example. You declare something in some odd language and then generate the bindings to any language you want, including C++.
 
@RMartinhoFernandes Getting closer
 
sbi
Now that I think about it, I have once initiated a tool, which was later extended a lot by my cow-workers, that can read and write half a dozen string resource formats across several platforms, including some proprietary ones. That does write headers files (which contain identifier definitions needed to access those string resources).
 
@rubenvb So, it's that elusive language, C∩C++?
 
8:31 PM
@RMartinhoFernandes dude, there's a large subset of C that is compatible with C++.
 
@rubenvb I know, that's what C∩C++ refers to (C/C++ is way to vague to be usable to refer to that subset)
 
although casts to void* might freak out the C++ compiler :/
 
And most use C/C++ to mean C∪{class,std::cout}.
 
lol
 
> @sehe What on earth are you talking about?! The registry and file system redirectors are fabulous. They make WOW64 viable. – David Heffernan 18 mins ago
> @DavidHeffernan Opinions vary, perhaps along with the definition of 'viable'. All this virtualization does violate the principle of least surprise and adds costs (allocation and runtime). Other operating systems manage to provide both better 32-on-64 support and better application virtualization with fewer snags/leaky abstractions (try running garbage collecting programs on Wow64, or try comparing md5 sums like the OP, and a few other niche cases). – sehe 18 secs ago
Mmm. for a half-troll I might be coming across a bit strong
 
8:43 PM
I was going to say exactly that.
 
I play way too many games
 
Another zero-progress day?
 
yeah
one of those "I woke up at 1pm, I ate breakfast, and then it was 6pm and I ate again, and now it's 9pm, and where did all the rest of the day go?" days
 
I know the feeling. But I don't know how to avoid it.
 
the real question is
where did I put my latest draft of the Wide spec?
 
8:53 PM
Online?
 
I thought it was in my repo... but it doesn't seem to be around
oh yeah, and that
 
Ell
bnf/ebnf cant be used to parse stuff with matching brackets can it? because they are for context free grammars. How does one concisely describe grammars that need matching brackets? :s
 
@Ell Matching brackets are context-free. It's regular expressions that cannot parse matching brackets.
 
expression_in_brackets := '[' expression ']' is a perfectly fine production in a context-free grammar.
 
hmm
 
Ell
8:54 PM
I'm trying to represent them with a state machine flowchart type thing on my whiteboard but i cant imagine it
 
next time, I'm gonna put the spec in the repo
@Ell Context-free grammars cannot be represented by a state machine.
 
@Ell FSMs can parse regular grammars, not context-free.
 
you're mixing up context-free, and regular
you need a DFA, or Deterministic Finite Automaton, which includes a stack for data
that's what EBNF does
FSMs can only do regular (regex) grammars
 
Ell
oh kk. hmmm
 
ok
now the Wide spec is going in the repo
can't believe I must have lost the latest version cause I never got around to committing it
 
8:58 PM
 
@DeadMG As usual, I blame you and not the tools.
 
Ell
lololol
 
@RMartinhoFernandes sorry, exactly what? That WOW64 is bloated, that I was coming across a bit strong or that I was half trolling?
 
@RMartinhoFernandes Oh yeah, absolutely my fault :P
 
@sehe The "bit strong" part.
 

« first day (517 days earlier)      last day (4414 days later) »