« first day (72 days earlier)      last day (4868 days later) » 

2:32 AM
Good evening!
 
3:07 AM
#include <iostream>

struct S {
    S(int) { }
    S(char) { }
};

void f(int) { std::cout << "int" << '\n'; }
void f(S) { std::cout << "S" << '\n'; }

int main()
{
    f('c');  // int?
}
 
 
1 hour later…
4:32 AM
When comparing the basic forms of implicit conversion sequences (as defined in 13.3.3.1)

— a standard conversion sequence (13.3.3.1.1) is a better conversion sequence than a user-defined conversion sequence or an ellipsis conversion sequence
[13.3.3.2/2 Ranking implicit conversion sequences]

`f(int)` is an exact match whereas `f(S)` requires an implicit conversion from `char` to `S` type via the parameterized constructor.
 
5:05 AM
I hate §13.3. Every time I have to figure out some overload resolution issue I have to read through it twelve times just to figure out what it is saying...
 
Als
5:46 AM
Hello
 
Hello.
 
6:07 AM
Hello
 
Hello!
 
7:04 AM
how are you James?
 
Hi is anyone here?
I have a question about hiring a programmer for a quick coding job
 
go on
 
where should I start looking for one? I require someone who knows PHP and MySQL for a site. Freelancer.com?
 
2
A: Is there a good site to hire programmers for little projects?

snmcdonaldCheck out the following sites: oDesk eLance scriptlance vWorker (originally rent a coder) Rent A Coder Code Monkey For Hire I know someone that reasonable success with oDesk.

 
The job is to design a simple equipment database for my guild/gaming site, so where talking about $30 to $50.
 
7:13 AM
I will add that do the list
 
Sweet
 
freelancer isnt on there yet
 
@snmcdonald I'm quite well, thank you. And yourself?
 
They seem to be high class companies
thanks
 
@JamesMcNellis I am alright. I deciding on investing on an android, iphone or win7 phone? i want something practical but also something I can develop on (hobby side)
 
7:20 AM
My opinion is a bit biased :-)
 
well I would like to hear it
 
it seems like scriptlance.com is the most suitable for little projects, what's your say?
Any experience? Hope they accept payment via paypal :P
 
If you're trying to pick a platform primarily for hobbyist purposes, you should pick whichever one you will benefit from most.
Presumably you don't have all three phones, so you should pick whichever one you do have.
 
good advice
 
Any of those three platforms are practical and worthwhile to learn. I'd be very surprised if any of them disappeared anytime in the near future.
 
8:11 AM
hello
Can you please confirm this? I'm scared to get this wrong. :-S I have a RAII object with a destructor but with no constructor. Does it make sense?
 
 
8 hours later…
4:22 PM
@wilhelmtell What does the destructor do? It's somewhat unusual to have a class with that requires a destructor but not a copy constructor and copy assignment operator, and if you declare a copy constructor, you basically have to declare at least one other constructor if you intend to create objects of that class type.
 
5:09 PM
@JamesMcNellis

logger log;
log << "This is " << 1 << " log record."; // flushed once, at semicolon
Come to think of it, the proxy isn't really a RAII object because it doesn't (need to?) acquire any resources on initialization. the logger acquires the resources; the proxy's cleanup procedure is to just use the resources.
 
sbi
@wilhelmtell That leaves James' question: Is it meaningful to copy log?
Does the default cctor do?
 
@sbi what? copy log?
 
sbi
@wilhelmtell If you don't want to do this, you need to declare a private cctor/assignment op. If you want to do it, you might need to define a public cctor/assignment op. In both cases the compiler won't generate a default ctor for you anymore.
Which is what James was asking you about.
 
but it's not the logger that's on the spotlight here. it's the proxy.
inserting into a log generates a proxy which plays with the resources. the resources are the sinks which handle the log entry. the proxy flushes the record when it destructs.
 
sbi
5:24 PM
@wilhelm Then you might have to give us the bigger picture. I don't see any proxy in that statement.
 
the proxy is private to the logger, so only the logger can create it and it will never copy it.
 
sbi
@wilhelmtell I see.
 
Maybe I should have said
log.debug() << "This is " << 1 << " log record.";
 
sbi
You have seen templog.org, haven't you? It does exactly this, only it employs expression template to defer using the parameters until it is decided whether this statement will be logged.
 
Oh. No I haven't. I just realized I need logging for my growing project, and after looking at quite a few libraries I decided I'm really not satisfied with any of them.
But I have never seen that one. I'll take a look.
 
sbi
5:32 PM
@wilhelmtell I had been pointing it out here recently, when @Tony asked about logging, so I thought you had seen it. It's a bitch for the template error messages it spits into your face when you do something wrong, but if you do it right, then for (something similar to) your log << "This is " << 1 << " log record."; VC9 generates zero code if logging is disabled for that statement at compile-time, and the equivalent of one if statement if it's disabled at run-time.
It's very hard to get faster than that. :)
OTOH, if you have code like log << "This is the result of calling foo(): " << foo();, then templog will call foo(), even if that logging statement is disabled. (Macro-based approaches have the call to foo() in debug build, and don't call foo() in release builds, leading to subtle erros.)
Unless, of course, the compiler can peek into foo() and see that it doesn't have any visible side-effects (as with std::vector<T>::size(), in which case it could eliminate it.
 
sbi
??
 
sounds good. a bit of a pity considering the time i already spent on writing yet-another-logger, but i guess that happens. i hated everything i saw.
 
sbi
I definitely know that feeling. :)
 
ay any rate, i'm going to take a look now at templog. maybe it will save me all the extra time i'd put on this little logging functionality i was about to write.
:-S
 
sbi
5:43 PM
I've used it in some project for a while and know some of its quirks and innards. Drop me a line here if you get stuck.
 
i spent the weekend on it. i had the basic logging done, and i was brainstorming with mindmaps to make it more extensible, exception-safe and threading safe.
is templog thread-safe? the most import things for me a corectness, exception-safety and thread safety.
 
sbi
Basically, templog falls into three parts: the loggers (where you send your log statements to), the sinks/whatever it's called (where they end up and get written), and the machinery in between (which you don't need unless it spits horrible compiler errors at you).
What needs to be thread-safe is the sinks.
Last time I looked, there weren't any thread-safe log sinks, but it's very easy to write your own.
A coworker of mine contributed one that emits log messages in GCC's diagnostic format, so that he can jump to the lines that created the message in his vim. (It already did that for VC.) Took him less than an hour.
 
nice.
but that means he had to use macros, right?
 
sbi
For the log sinks? No.
 
for the line numbers.
and filenames.
 
sbi
5:49 PM
Those are built in. Where there's your log.debug(), templog uses a macro. That provides __FILE__ and __LINE__ (plus more), and hides the ugly expression template machinery.
Instead of your logger log; in templog you have to define a template:
  typedef templog::logger< templog::global_logger
                         , templog::sev_warning
                         , templog::audience_list<templog::aud_developer,templog::aud_support> >
                                             my_logger;
 
exactly. that was one of the decisions i was struggling with. ultimately i decided to drop that filename and linenumber features so i don't need macros, but it was a hard decision.
 
sbi
(That's from its getting startled doc)
3
You then need to call a member of my_logger in order to log something, providing two parameters (severity and audience) on which the statement will be filtered.
In this example, my_logger will forward directly to the global logger (first template parameter), but you can create as complex trees of loggers forwarding to each other as you like, filtering on the way to that global logger. It's all evaluated at compile-time, so it won't hurt at run-time.
Anyway, that member function you call also takes file name, line number, compilation date and time (poor man's versioning), and, if your compiler supports it, the current function's name, which are best supplied using a macro.
That's why you need to write
TEMPLOG_LOG(my_logger,templog::sev_error,templog::aud_support) << "Some variable has an unexpected value of " << some_var;
supplying all this.
 
mouthful!
but sounds extensible
 
sbi
This was copied from that getting startled doc. A few using declarations make it easier.
Anyway, that sev_error and aud_support are used for filtering.
 
what's truly important for me is correctness so i don't need to think about it, exception-safety so it doesn't get in my way with errors, and thread-safety so it copes with my concurrent application.
 
sbi
5:57 PM
Filtering is done at compile-time (the definition of my_logger declares which it will pass on) and at run-time, by your log sinks.
I've used it successfully in one project where speed was a prime and have seen no error. Thread-safety, as I said, is something a log sink needs to be.
Since it's mostly template machinery to filter, from what I saw there's no exception issues in the machinery.
And my coworker found the guy quite responsive. From what I remember, his log sink was incorporated quite fast.
 
cool
 
sbi
Oh yeah, and I like the boost license. Freely copy, earn money with, and hack away at it at your will.
Beats the shit out of GNU.
 
how do i install it?
 
sbi
Except for one log sink for VC it's all headers.
 
just bring over the headers in the root directory to my project?
 
sbi
6:09 PM
That's what I did for VC on Windows. My coworker, on some Linux distro, put it into some system header folder.
 
 
4 hours later…
9:55 PM
@sbi Ha! "Getting startled"!
I'll have to look at templog; I'm in need of some ideas for the logger for my C compiler.
 
sbi
@JamesMcNellis Yeah, olde pun, I know. My problem is I rarely ever can resists any pun...
@JamesMcNellis TinyC or C99?
 
@sbi C89/90. I'm writing everything myself; no third-party libraries.
 
sbi
Here's a piece of prose I just wrote in a comment:
Over time I've come to believe that, in C++, "impossible" is always only a temporary answer to any problem someone needs solved. In 80% of all cases, someone comes along and bends templates, macros, and some of those "features" we would get along quite well without to their purpose, thereby achieving what everybody thought was, indeed, absolutely impossible. I bow, though slightly shuddering, before this idea. May you live long and may your code never cross my path.
 
@sbi Ha!
 
sbi
@JamesMcNellis Why are you writing a C compiler? Too much time at hand or a task at work? Aren't you with MS? They do have a C89 compiler, they lack a C99 compiler!
 
10:09 PM
@sbi I'm interested in compilers and I needed a fun project (as a hobby; not at work). I'd consider adding C99 features later, but I wanted to restrict myself to a smaller set of features to start with.
 
sbi
@James Oops. Thanks for the vote. (Honestly, I did not bring this here to fish for up-votes!)
@JamesMcNellis Mhmm. I tend to think there's nicer things to do in your spare time than writing a C compiler. But each to their own...
 
I had a lot of fun implementing the preprocessor earlier this year... it was quite a challenge. Macro replacement is far more complex than it looks :-P
 
sbi
@JamesMcNellis Implementing a piece of software to work exactly as erratic as another piece of software that's been around a couple of decades is certainly bound to be a lot more complex than it looks at first sight. (No matter how complex it looks at first sight.)
3
 
Well, what can I say? I have a sick idea of "fun." :-D
 
sbi
10:26 PM
@James Well, that really wasn't giving anything away we didn't know. Of course your idea of fun is sick. How else could you have earned 5k rep in the c++ tag?
(Ha, and I only earned 3k. Which means I'm only half as sick as you are!)
 
Seriously.
 
sbi
Was that a question, a correction, or a statement of its own (referring to God knows what)?
 
"Seriously, I do have a sick idea of fun. How else could I have earned 5.9k upvotes in [c++]?"
@sbi Ha ha ha. That's a nice trick to star your own post :-D I had no idea you could do that!
 
10:45 PM
In templog,
    typedef templog::logger<templog::global_logger,
                            templog::sev_debug,
                            templog::audience_list<templog::aud_developer> >
                                log;
    TEMPLOG_LOG(log,templog::sev_debug,templog::aud_developer)
        << "starting ...";
gives me
main.cc: In function ‘int main(int, const char* const*)’:
main.cc:53:5: error: ‘template’ (as a disambiguator) is only allowed within templates
Any idea?
 
sbi
Which one is #53?
 
The line starting with TEMPLOG_LOG(.
 
sbi
Ugh.
That messages look like GCC.
 
Preprocess it and see what it's generating?
 
OH ! I think i know
I guess it's because templog doesn't support typedefing inside a function?
 
sbi
10:47 PM
I don't think that macro is very complex, no?
 
It's because you use the .cc file extension. Who does that?! ;-)
 
lol
 
sbi
@JamesMcNellis Yeah, I found this accidentally.
 
@wilhelmtell Why would it matter where the typedef is?
 
mm no that's not it
 
sbi
10:48 PM
@wilhelmtell I don't think so, although it could be. I don't think I ever defined a logger with finer granularity than file level, so I wouldn't run into this.
 
i thought for a moment that the typedef expands to something starts with "template" and that it's meant to be in global space. or somethin.
 
sbi
@JamesMcNellis There's things you can do at namespace scope, but not at function scope.
 
i have no clue.
 
sbi
Lemme have a look at that...
 
but the code is taken directly from the example code. minus the aud_support bit. and i call it log, not my_logger. but that's it.
 
sbi
10:51 PM
@wilhelm: I've only ever used the thing with VC, which doesn't implement proper two-phase lookup, so gets these typename thingies wrong quite often. If the guy developed on VC as well, such things might have slipped through.
 
typename thingies?
 
sup SO
 
@wilhelmtell That's a technical term.
 
sbi
typename of template, rquired due to two-phase lookup.
 
you mean forgetting to say typename?
k
 
10:53 PM
how to remove duplicates from an C array with better complexity than O(n^2) ?
 
sbi
@JamesMcNellis Haha.
Mhmm.
 
@Glorian: Sort it in O(nlgn) and remove the duplicates in O(n). (You can do this in two lines of code using std::sort and std::unique.)
 
sbi
This dosn't look like it has any superflous template:
#define TEMPLOG_LOG(TLogger_,Sev_,Aud_) TLogger_::get_forwarder(TEMPLOG_SOURCE) = \
               templog::get_intermediate<TLogger_,Sev_,Aud_>()
 
@Glorian sort the array first. Then, find the first two adjacent elements, remove all elements until a differenent element, repeat.
 
better than n logn solutions ?
 
sbi
10:54 PM
@wilhelmtell std::sort(), std::unique()
 
it still feels like shit
i mean
too slow for me
 
Does "too slow" mean "this is a performance hot spot in my code and I need to improve its performance" or "I want better theoretical performance"?
 
thats a good idea
oh by the way
 
:220078 Technically the complexity is still the same but the performance would be almost guaranteed to be worse.
 
what is faster ?
std::sort or own implemented quicksort ?
 
sbi
10:57 PM
@wilhelm can you try what this makes the compiler choke on:
log::get_forwarder(TEMPLOG_SOURCE) = templog::get_intermediate<log, templog::sev_debug, templog::aud_developer>() << "starting ...";
 
or qsort from cstdlib ?
 
As is the case with all "which is faster?" questions, the answer is you have to test it with your data and see. That said, unless std::sort is too slow, you should use it.
 
sbi
@Glorian Theoretically, since you know more about your data, you might come up with a faster sort than std::sort(). In practice, especially if you need to ask, it's very unlikely.
 
Is this the fastest method? is almost always the wrong question. You should be asking is this method fast enough?
 
generally i'm going to sort some standard variables with obvious comparision methods
look, i'm going to write a graphics engine
and I need the best performance
at every chunk of code
 
10:59 PM
The line
 
thats the reason of why I'm asking "what is the fastest way"
; p
 
    log::get_forwarder(TEMPLOG_SOURCE) = log::get_intermediate<log,templog::sev_debug, templog::aud_developer>() << "starting ...";
 
sbi
@Glorian No you don't. The part that reads your scene from the disk will likely be IO bound and performance insensitive. James is right. You need to measure!
 
gives me
error: no matching function for call to ‘templog::logger<templog::non_filt
ering_logger<templog::sev_aud_formating_policy, templog::stderr_write_policy>, 1, templog:
:audience_list<1> >::get_intermediate()’
 
@Glorian Having worked for two years on real-time 3-D simulation products, I can tell you this isn't true. You will need certain parts of the code to be very fast, and you should optimize those parts heavily. Most of the code will never be in the critical path.
 
sbi
11:01 PM
@wilhelmtell Mhmm. That's a different error. Did I do something wrong when I substituted?
 
@sbi i changed templog::get_intermediate to log::get_intermediate.
 
sbi
@wilhelmtell Huh? I had written log::get_intermediate!
I'm lost. Where are you?
 
Ok, here's what I see in logging.h
#define TEMPLOG_LOG(TLogger_,Sev_,Aud_) TLogger_::get_forwarder(TEMPLOG_SOURCE) = \
                                        TLogger_::template get_intermediate<Sev_,Aud_>()
this looks wrong.
 
sbi
Yep.
 
I don't know what TLogger_ is, but wtf is TLogger_::template ?
 
sbi
11:08 PM
TLogger_ is the macro's first argument.
template must be a syntax error.
 
So how can it even work on vc 9?
i mean this is templog 0.5
supposedly the latest stable version.
Yeah, TLogger_ is my log object then. That can't possibly be correct, log::template.
What version are you working with?
 
sbi
@wilhelmtell It is. It's the same as with typename. Look it up, there ought to be dozens of such questions on SO.
@wilhelmtell Checkout of the trunk. :-/
@wilhelm I've checked, the 0.5 release has indeed faulty code. That's not in the trunk.
Try to checkout this:
Ha, don't bother!
That's wrong, too.
I have a local modification (done by that coworker) which made that call a member rather than a free function.
 
Removing the template keyword, to get TLogger_::get_intermediate rather than TLogger_::template get_intermediate resolves the issue. Now I'm down to linker error.
Undefined symbols:
  "templog::get_short_name(templog::audience)", referenced from:
      void templog::sev_aud_formating_policy::write<templog::stderr_write_policy, 1, 1, te
mplog::templ_meta::nil, templog::templ_meta::tuple<char const (*) [20], templog::templ_met
a::nil> >(templog::templ_meta::nil&, char const*, unsigned long, templog::templ_meta::tupl
e<char const (*) [20], templog::templ_meta::nil> const&) in main.o
  "templog::get_short_name(templog::severity)", referenced from:
      void templog::sev_aud_formating_policy::write<templog::stderr_write_policy, 1, 1, te
 
sbi
Anyway, remove that template and you should be well.
Ah, you did.
 
I thought it's headers only.
-L. doesn't help
 
11:19 PM
It sounds like there is some template that has its declaration separated from its definition and the two don't match. (complete guess)
 
sbi
Well, there's this imp/logging.cpp <sheepish_grin>
This, too, has changed in the trunk.
I think I still have that guy's email address archived somewhere, from when we were hacking away at this. I'll ping him about releasing a fix. (And I will send in my patch.)
 
He he. So, what you're saying is that this logging library is awesome once you hack at it to make it work :-P
 
Ah. So I suppose it's not headers only. The makefile builds it but it doesn't create a library.
 
sbi
@JamesMcNellis :(
@wilhelmtell Doesn't it come with CMake support?
 
I only tried the makefile.
with make.
I don't have cmake
 
sbi
11:25 PM
Ha! Look at this: "I haven't found much time to work on this in the last months (that's why there haven't been any new releases). However, I did indeed work on it somewhat. The latest development is on a branch, which did not yet get merged into the trunk. If you don't want to wait for a new release you can have a look at the current code through sourceforge's ViewVC. You can also check out (or export) the code using SVN with this ... URL."
 
it has very nice documentation but it really needs an INSTALL file.
 
i think that statement is from 2007. :p
0.5 is 2007
oh the trunk
k
in other story, in 5 points i'll be a moderately moderated moderator. what a privilege. k sry. carry on. you were saying?
 
sbi
@wilhelmtell Now you are. :)
 
lol sorry it really wasn't a nudge
 
11:29 PM
you now can see all my deleted posts that I made when I was drunk
 
@JohannesSchaublitb oh god going right away to see them! UNDELETE!!!!1
 
sbi
Anyway, I do need to go to bed. It's passed midnight here, and I'm not a student as Johannes and have kids to tend to tomorrow.
 
@sbi: Goodnight.
 
sbi
11:30 PM
@JohannesSchaublitb ?? (And didn't you once say you're not party-compatible? So do you drink alone at home?)
 
@wilhelmtell: Congrats!
 
good night sbi
 
sbi
Goodnight!
 
@sbi i'm kidding! don't worry =)
that said, I had some very funny parties with lots of, erm, fluid
 
No comment.
 
11:32 PM
you know, good old beer
but most of the time, i'm not in party mood
 
the word "delete" is also so politically correct. it should be "click here to be at the mercy of strangers".
@sbi goodnight, and thanks for the help! I'll keep banging at templog. hopefully i'll get it to work before i bend and go back to my attempt at it.
 
When I reached 10k, I felt a lot less dumb. It's nice to see that lots of other people delete a lot of their answers and get things wrong sometimes.
 
:) man the count of stupid things i said.
technically stupid answers and humanely stupid comments.
 
I started to write "I closed this because of XYZ" lines into my deleted answers
 
i talk about it in past tense as if there shall be no more of these. right.
 
11:39 PM
If I post something really dumb and realize it within the five minute edit window, I'll replace the post contents with ---------------------------------------------.
Oh well. We can't all be as smart as Johannes. :-D
 
i'm not as smart as you :(
but I think that's alright
lol
 
Yep. And together we can make other dumb people feel at home. It's beautiful.
the same exact code compiles fine and passes tests in templog's test suit.
with the template thingy.
on gcc.
man.
 

« first day (72 days earlier)      last day (4868 days later) »