« first day (372 days earlier)      last day (4562 days later) » 

3:17 PM
Not very elegant though.
 
3:32 PM
is it reasonable to assume that any compiler has some extension that lets you construct or open a filebuf with some native descriptor?
 
Hey, pastebin.com/PEmZFJi8 what's wrong with that? It segfaults, it's the first problem of the euler project.
 
What is int array[] = {}; supposed to mean?
If anything, you get a zero-size array. Not very useful.
 
that should not compile
 
probably an extension
 
I was actually about to post a question regarding the possibility of an array without a predefined size, but when I tried it in another program by adding two values it worked. So I dismissed the problem.
 
3:40 PM
Replace int array[] = {}; by std::vector<int> array(size); and i <= (sizeof(array)/sizeof(int)) by array.size() and it should probably work.
#include <vector>   // <-- don't forget this include
 
cpx
smells like incomplete type
 
Thanks, I'll try it Fred.
 
@Griffin Also, you forgot to initialize sum. Write int sum = 0; please.
Or you could just get rid of the loop entirely and write int sum = std::accumulate(array.begin(), array.end()); if you #include <algorithm>.
Do you even need the array? Can't you just directly add to sum in lines 11 and 15?
 
Hmm, yeah. I suppose you're right. It doesn't want to compile though, it complains that size wasn't declared in that scope.
I'll go ahead and read about vectors and the algorithm library though, thanks for your help.
 
@Griffin Just post another link to ideone here and I'll gladly help.
> If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000.
 
3:48 PM
Yeah, that's the one.
 
@Griffin I don't see how your program achieves that at all. All you do is check for even and odd numbers.
 
Since I couldn't do array[i] and array[i+1] each time, I figured I could just add the multiples to the array each odd and even numbers.
Maybe that was a bad idea.
 
Why the heck can't I register at Project Euler? If I try, all I get is a blank page.
 
I don't know, I haven't really registered. Only tried to solve the problem.
 
Does the star next to my message mean I'm not the only one with the problem?
 
cpx
3:57 PM
@FredOverflow I thought it was clever question ;)
 
Thanks for you're help, I got to go now. Gonna check out vectors and algorithms.
 
@Griffin you can solve it in one line, btw
 
1
Q: std::make_tuple doesn't make references

awoodlandI've been experimenting with std::tuple in combination with references: #include <iostream> #include <tuple> int main() { int a,b; std::tuple<int&,int&> test(a,b); std::get<0>(test) = 1; std::get<1>(test) = 2; std::cout << a << ":" <...

 
4:26 PM
@Griffin If you're interested, here is my solution without arrays or loops.
 
4:38 PM
anybody know what the use of sample buffers are in OpenGL?
 
@CatPlusPlus Crappy workaround until someone gets a syntax file out: let c_no_curly_error=1
@FredOverflow Works here.
(I feel a sense of déjà vu :)
 
4:54 PM
Woo, rain.
 
Ron
I am pretty sure its the wrong place for my question - but I dont know which room fits. anyway - I want to make User Manual/Help that looks like Office 2007 help - any suggestion what tool can make it?
 
5:10 PM
@johannes: thanks for this code
namespace detail {
    template<int> struct D {};
    typedef char yes[1];
    typedef char no[2];

    template< class T, class U >
    yes& f( int, D< sizeof T(*(U*)0) >* = 0 );

    template< class T, class U >
    no& f( ... );
}

template< typename To, typename From >
struct IsExplicitlyConvertible
{
    enum{ yes = (sizeof detail::f< To, From >(0) == sizeof( detail::yes ) ) };
};
^ I found that in an old clc++m posting by Johannes when I googled this problem
 
5:36 PM
Why all the pointers?
Oh wait, std::declval is new?
 
what's that?
anyway, he's just using pointers to get a pseudo-instance
could alternatively do that by declaring a static function with U result
 
That's what std::declval does :)
 
@RMartinhoFernandes Yes. Consider that its return type is typename std::add_rvalue_reference<T>::type.
 
Oh, right.
 
I hate PHP. I hate web-design courses. I hate local servers. I hate wamp. I hate IIS. Why can't one do web designing in C++? :(
 
5:41 PM
Er, because C++ sucks for that?
@IntermediateHacker (I'm purposely not saying whether PHP is better or worse.)
 
@RMartinhoFernandes And PHP doesn't suck?
 
@IntermediateHacker i can understand hating IIS, but it's easy to set up PHP with IIS. and if hate is strong enough, or fear is strong enough (IIS is almost like IE wrt. malwave), install Apache
 
@AlfPSteinbach PHP manager for IIS isn't even installing correctly. The Web Platform installer quits with a stupid error.
 
@IntermediateHacker well it's many years since i done that. but i had no problems.
 
It worked well for me in the past, too.
 
5:44 PM
And worst of all. I've already got IIS for ASP .NET, and apache isn't working correctly with it. According to the FAQ u need to uninstall IIS to get Apache working. :(
 
Why the heck I installed PHP, I do not want to remember.
@IntermediateHacker I had both working fine on the same machine.
 
you don't necessarily need to uninstall it, but if you want apache running on port 80, you will have to disable iis
 
@RMartinhoFernandes I guessed I messed something up then.
 
or tell it to use a different port for the default site
 
Right, you can't have both on the same port.
 
5:46 PM
@cHao Thanks.
how do u disable IIS?
 
easiest way i know of is through servies
services*
i think it's called the "world wide web publishing service"
you don't need to worry about the others
 
which service should I disable? (sorry i'm a newb at web dev)
 
hello, why do i need the single second std:: qualification here?
class InFStream
    : public std::ifstream
{
public:
    InFStream() {}
    explicit InFStream(
        char const*         filename,
        ios_base::openmode  mode =  ios_base::in | ios_base::out
        )
        : std::ifstream( filename, mode )
    {}
};
 
std::ifstream, on the third line from the end?
Because ifstream is not in scope?
 
5:51 PM
yes, or alternatively why do i not need to qualify ios_base. i thought these names were injected in the class sort of
 
Oh, you're not using std::ios_base anywhere?
 
I would expect the need to qualify that as well then.
 
compiles fine with MSVC and g++
 
Hmm. Weird.
Make a question?
 
5:54 PM
Gain some rep.
 
good idea. it's probably trivial. so someone else will also gain... :-)
 
guys, what do you think of msvc 2011?
 
WTF man, 40 KB/s is barbaric. Just because it's raining oceans out there, doesn't mean I need to get my connection completely fucked up.
@bamboon A great disappointment.
Sucks balls on the C++11 support department.
 
do you have a quick link to the features which are supported?
otherwise will google it quick
 
It's around here in this chat. Gimme a sec.
 
0
Q: Why no qualification necessary?

Alf P. SteinbachOK, I'll just post the complete program even though it has extraneous stuff and the code in question is the dead code… #include <iostream> #include <fstream> namespace detail { // Solution by Johannes Schaub alias litb // http://groups.google.com/group/comp.std.c++/br...

 
Have a +1.
@bamboon Right that's the one.
 
yeah, seriously quite much red on it.
 
To me the worst offenders are: no variadic templates, no explicit conversion operators (WTF man, we'll still be stuck with the silly safe bool idiom!) and no default and deleted functions.
Oh, and no "expression SFINAE". That's so powerful! (And apparently it was supposed to work on C++03 already.)
 
i am not yet that expert to use all these features but variadic templates really sound good
 
6:06 PM
But those could be justified with implementation effort, maybe.
Explicit conversion operators no.
The code is already there.
 
for a company like microsoft and the state of the are product msvc there are no excuses
 
Same for defaulted and deleted functions.
The compiler is already capable of generating constructors automatically.
It's just a matter of changing the grammar.
 
on the bottom of the side there is a table in which they show much bytes all the containers need. the numbers are getting smaller, is this because of optimations they do or because they cut things out?
 
Optimizations, I guess.
I don't see what they can cut.
 
yeah, they write it in the text actually^^
 
6:12 PM
> We're also going beyond C++11 in a couple of ways:
What?
Why are they going beyond when they aren't there yet?
Oh, and did you notice that r-value references don't use the latest version of the rules?
 
haha yes thats funny
but according to the note it is because of a bug fix
 
But they didn't update it to v3.0!
They fixed a bug in an outdated version.
This means you can't write code with rvalue references and expect it to compile well in g++ and MSVC.
 
@RMartinhoFernandes Yeah, I found that.
 
Maybe I should post a question with a 500 rep bounty asking for a full-featured vim syntax file for C++11 :)
 
is herb sutter actually on ST?
 
6:22 PM
What's ST?
 
errm i mean stack overflow
 
Ah, I don't think so.
Howard Hinnant is actually pretty active in the C++11 tag.
 
Herb did have an account but hardly used it IIRC
 
I don't know any other C++ committee members that are active on SO.
 
@AlfPSteinbach This reminds me of member function definitions that take an argument of which the type is defined inside the class and that return a type that is also defined inside the class. The arguments won't need qualification but the return value will.
 
6:26 PM
Grand total of 671 rep, definitely not active
 
last seen oct 13 implies he still reads
 
his pic is so cool^^
 
Hey! Look at this:
35
Q: Stack Overflow and GotW

Herb SutterPer Jeff's request, redirecting here: I have a question about using SO as a forum to publish content. Now that the next ISO C++ standard is pretty much locked down, I’m thinking of going back and revising all my popular Internet-published Guru of the Week (GotW) articles, which along with my tr...

But then :(...
11
Q: Stack Overflow and GotW: what happened with this?

KoperI was very excited about the Herb Sutter posting GotW articles on Stack Overflow. He asked a question here on meta to - basically - ask for permission, and since it has 26 upvotes and 0 downvotes there is no doubt the community wants this. I was looking forward to it but apparently nothing happ...

 
@StackedCrooked well but that's because the compiler doesn't know about the class until it has encountered the (qualified) member name. I think one can avoid result type qualification here with C++11 syntax.
 
@RMartinhoFernandes First it was like Ééééé and then it was Èèèèè...
 
6:38 PM
Howdy
 
Howdy ManO1
 
@CatPlusPlus How's the OpenGL going?
 
6:59 PM
Is it okay to inherit from lambdas?
I.e. is there a caveat I'm missing?
 
uh
a bit wtf, but I don't see why it couldn't be done
 
Building a variant visitor from a series of lambdas :)
 
you might have fun with lambdas that aren't captureless, though
as I believe there is no Standard way to construct one except through copy or move
 
Oh noes, my humanity is doubted!
We apologize for the confusion, but we can't quite tell if you're a person or a script.

Please don't take this personally.

Bots and scripts can be remarkably lifelike these days!

Enter the CAPTCHA displayed below, and we'll be out of your way.
 
I've had that often
 
7:05 PM
@RMartinhoFernandes How would you write the syntax for inheriting lambdas?
 
@StackedCrooked Templates?
 
0
A: best way to do variant visitation with lambdas

R. Martinho FernandesYou could use variadic templates to take the lambdas, and build a variant visitor using inheritance. That would retain the compile time checks. template <typename... Lambdas> class lambda_visitor : Lambdas... { lambda_visitor(Lambdas... lambdas) : Lambdas(lambdas)... {} }; And a litt...

 
I was thinking getting the type with decltype and typedeffing that to a named type. Which can then be inherited (or not).
@RMartinhoFernandes Well, that not a question you hear every day.
 
It's amazing how small the solution can be :)
(I have yet to test it though. fires up ideone)
Hmm, I could also try some shenanigans to detect the return type...
Do lambdas have a return_type typedef or something?
 
7:14 PM
typeof?
 
I'd need values for the arguments for that.
Which means I need a way to know the arguments of a lambda.
 
You can't really capture return type. One thing you can do is to pass it to a function and then it will select the overload that matches your type.
 
That sounds like too much hassle.
 
Even BOOST_FOREACH can't capture the return type. It is required as an argument.
 
Yes, but if I could do typename Lambda::return_type... :)
 
7:22 PM
Btw, what is the difference between capturing the return type and capturing it as auto? In both cases you're using an alias without really know what the type is.
 
I need to know the return type of the lambda to pass it to boost::static_visitor.
Why is this ambiguous? ideone.com/6mGul :(
 
if I want to cast an unsigned char * to an unsigned int*, what's the best cast to use?
 
reinterpret
decltype?
 
decltype is not a cast.
 
cpx
would this be any different int *i = static_cast<int*>(static_cast<void*>(c)); than reinterpret?
 
7:29 PM
@cpx reinterpret_cast does exactly when the two types involved are pointers or references to standard layout types.
 
sbi
Damn. I must be a bot. Just failed a captcha. Twice.
 
It works. Now I'm trying to figure out Freetype.
And then texturing.
 
Nice, you got a card supporting opengl4 and glsl 150? =)
 
OMG no immediate mode. How is that possible?
 
It's 3.2.
 
7:31 PM
okey
 
GL 4.0 is GLSL 4.0, strangely enough.
@RMartinhoFernandes Magic.
 
:)
So, no help on my ambiguous lambda adventures?
How come "main()::<lambda(std::vector<int>)>" is a candidate for visitor(12)?
GCC bug?
 
@CatPlusPlus You're using some windows thingy instead of glew?
 
cpx
@RMartinhoFernandes hm, would it safer than reinterpret_cast?
 
@cpx Really, it's the same.
reinterpret_cast is defined in terms of the expression you wrote (for those types).
 
7:35 PM
@ManofOneWay I'm using GLload instead of GLEW. GLEW didn't work properly, or something.
 
I think it's best to go with reinterpret_cast as it makes clear what kind of nastiness is going on.
 
cpx
alright, maybe specific to those types.
 
For types where reinterpret_cast is not defined, the chained static_casts are not defined either.
 
Dang. It's a lot of work to support general filenames in Windows. current code is just for ifstream. It's amazing that apparently nobody's done this already. It's almost like nobody's using standard library streams to hande files in Windows, or, they only use Visual C++, or, they don't care about general filenames?
and i'm tired, i immediately now saw a missing inline
argh
 
7:56 PM
@AlfPSteinbach You are overestimating real-world C++ developers.
 
Oh, there are answers to @Alf's question.
It makes sense now!
 
I think it sucks that typedef is so restricting.
Friendship with a typedef is also not possible.
In the end all these restrictions kind of defeat the purpose.
 
typedefs are anti-social.
 
anti-social?
 
They don't like hanging out with friends.
 
8:04 PM
Ha.
Perhaps it the friends that refuse to hangout with an alias of their friends.
Or something like that.
 
on the positive side, typedefs enable pseudo-destructor calls. you can't write int x; x.~int(), but I think you can write typedef int Integer; Integer x; x.~Integer(). :-)
 
sbi
First and foremost, typedef is a bad case of a misnomer: It doesn't define a new type, just an alias for an existing one.
 
Strong typedefs would be cool.
(There's some magic macro on boost, though)
 
@AlfPSteinbach I can't wait to start using this in my code :D (not..)
Strong typedefs can be achieved throw inheritance :)
`class Id2FirstName : public std::map<int, std::string> {};`
`class Id2LastName : public std::map<int, std::string> {};`
 
@StackedCrooked strong typedef int Integer;?
 
8:07 PM
@RMartinhoFernandes You can just start inventing keywords. Don't you know that?
 
Also, I want GCC to implement the new typedef syntax.
using Integer = int; is so much better.
Or clang to catch up on GCC.
 
Yep, this is a feature that I will probably appreciate. I use typedefs a lot.
 
BOOST_STRONG_TYPEDEF.
 
It feels like Arnold Schwarzenegger just entered the room.
template<typename T> struct Typedef { operator T() { /*...*/ } };
I suspect it uses something like this?
 
8:11 PM
I guess that BOOST_STRONG_TYPEDEF uses something like this.
I could be totally wrong though.
 
struct silly_t { silly_t operator()() const { return *this; } };
silly_t silly;
silly()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()();
I'm bored.
 
Silly LISP.
 
I have this poor-man solution.
#define WRAP(ClassName, Type) \
    struct ClassName { \
        explicit ClassName(Type inValue) : \
            mValue(inValue) {} \
        operator Type() const { return mValue; } \
        Type mValue; \
    }
 
8:14 PM
Not assignable.
 
As I said, poor man's solution. I use it mostly for named arguments.
WRAP(Width, int);
WRAP(Height, int);
rect.setSize(Width(10), Height(20));
It is actually helpful to prevent arg mixups when calling functions that take a lot of arguments.
 
Boost.Parameter.
 
sbi
@CatPlusPlus Actually, LISP would nest the parens, rather that than concat them.
 
@sbi That's why it's silly.
 
sbi
@CatPlusPlus Oh. I thought LISP is silly even in its pristine form?
 
8:18 PM
Lots of Irritating Silly Parentheses.
 
Clojure is actually a nice lisp dialect.
I spent about 3 months doing a Lisp hobby project. Got used to the parentheses quickly. The consistency of the syntax makes up for the initial awkwardness.
 
One day I'll learn CLOS just to see why all those Lispers keep saying it is unlike any other OO system.
 
It has multiple dispatch.
 
I learned the other day that the fabled superb LISP macros actually suffer from the some of the same issues of C's macros.
@CatPlusPlus That it?
 
And aspect-oriented stuff like before and after hooks.
 
8:22 PM
@RMartinhoFernandes Actually when I finally got to lisp macros the first rule I encountered was: avoid macros, prefer functions.
 
sbi
@StackedCrooked I spent half a semester learning some LISP (learning PROLOG the other half, BTW). IME it takes a good editor to help you to write the exact number of closing parens. We did not have such an editor. I was annoyed. Very annoyed.
 
Well, that's all I know that makes it different than the most. Not that it makes up for the sillyness of CL.
 
@CatPlusPlus That is especially one of my desired features.
 
@sbi Half-clever editors are the worse.
The ones where if you type "(x)" you end up with "(x))".
 
@sbi I used Notepad++ on Windows. It handles paren highlighting excellently.
 
8:23 PM
Even with editor writing parenthesis, I still can't read the damn thing.
 
sbi
@RMartinhoFernandes Well, I have to admit: this was >15 years ago.
 
I can cope with dumb editors or smart editors.
 
And prefix notation for absolutely everything is not making it easier.
 
It's the half-witted ones that make me go insanely homicidal.
 
sbi
@StackedCrooked The guy who wrote N++ was probably still wetting his diapers back then. :)
 
8:24 PM
Paren highlighting however is essential when using lisp. I think it would be nightmarish without.
 
sbi
@StackedCrooked would? It actually was.
 
Or emacs, if you're into that kind of thing.
 
I saw a Lisp dialect using indentation based syntax instead.
Now that was a bit better.
 
@RMartinhoFernandes Emacs is great if you're into RSI.
3
 
8:25 PM
@StackedCrooked Right, that kind of thing.
 
sbi
Anyway, my Internet connection is still very flaky, even though my daughter stopped skyping with her boyfriend, so I cannot blame her anymore. :( Maybe I should take the hint and go to bed.
 
@sbi Going to bed and flaky internet are orhogonal things. Don't you know that??
 
Emacs is a nice OS, but it lacks a good text editor.
 
Screw emacs, I only have two hands.
3
 
sbi
8:27 PM
@StackedCrooked Well, "going to bed" for me usually means "read until your eyes close by themselves". So this would be a reading night, rather than a chatting one.
 
There are people that claim using viper-mode gives you vi inside emacs. Not in my experience.
 
No really why would you want that?
 
You know what's bad? Not only I have to put up with Oz, I also have to use Emacs for it, because someone thought it would be a good idea to tightly integrate the two.
 
@sbi Well, either way works.
 
vi sucks.
 
8:28 PM
Who said anything about vi?
 
Ok, I use Vim technically. But not really for development.
 
He did.
 
I like Vim though.
 
vi != vim.
 
8:29 PM
@CatPlusPlus that's the reason why I clarified.
 
vim ⋙ vi.
 
Vim macros super power.
 
sbi
@StackedCrooked Except that my alarm will ring 5:55am, which is in about 7.5hrs. I should sleep, really.
 
vi is just ed on drugs.
 
@sbi Happy reading.
 
8:30 PM
@sbi You have my permission.
 
Er, sleeping.
 
sbi
Screw emacs, I only have two hands.http://chat.stackoverflow.com/transcript/message/1734731#1734731
 
@CatPlusPlus So Vim is ed on meth? Or something?
Bill Joy (who created vi) admitted using ed instead of vi because different systems provided different vi configurations.
 
∀ x ∈ Editors. vim ⋙ x
 
Emacs is nano on meth.
2
 
8:35 PM
Eclipse is Visual Studio with obesitas.
@RMartinhoFernandes What does the >>> operator mean? (Shove up ass?)
5
 
As if Visual Studio was thin.
 
Good point. Esp 2010.
 
@StackedCrooked "Very Much Greater-Than"
 
QtCreator is currently is nice solution. (Not too light, not too heavy.)
 
Who needs IDEs.
Oh, right, Java programmers.
2
 
8:37 PM
The amount of code generation going on when using Java in Eclipse is staggering if you add it all up.
 
Silly languages without code generation facilities.
 
c.vim fails to highlight #include MACRO.
 
This is truly a language that has become interwoven with the IDE. My dad used to be a nurse. He told me of old unhygienic women who had their stockings grown into their skin. Java & Eclipse reminds me of that.
 
Gosh, why are you doing that?
 
Freetype does that.
 
8:39 PM
Run for the hills.
 
It's fine. Besides, know any other font handling library?
 
I got my vim settings here. Allows me to quickly get the entire setup with plugins and all on a new machine.
 
@CatPlusPlus No.
@StackedCrooked I keep a very old backup at github. One day I'll have to move it to bitbucket and update it.
 
I don't really care where you are storing it :)
But good to know :D
 
Well, I don't care where you keep yours either. :P
 
8:43 PM
I'm being unkind.
 
I think I'll make a vimball out of them or something.
 
For some reason I try to switch between gvim tabs with Ctrl+A, 0
Damn you, screen.
 
Super duper easy to deploy.
@CatPlusPlus Map it?
 
Ctrl+A? Why this particular key combination?
This was one of my first SO questions:
13
Q: How to share one vimrc file among multiple clients?

StackedCrookedI am not a very orderly person at times and I often find myself in the situation of loosing my old fully tweaked vimrc file and having to start over all again. Or having different versions of vimrc files on different clients. Since this mess is getting out of hand for me, I would like to know if ...

 
Screen uses Ctrl+A.
syn match cInclude display "^\s*\(%:\|#\)\s*include\>\s*\(["<_]\|[a-zA-Z_][a-zA-Z0-9_]*\)" contains=cIncluded
Good enough.
 
8:47 PM
You hacked that to highlight that scary thing?
 
Yup.
At least FT doesn't force you to use global state or anything.
 
You're using OpenGL.
The thing is a state machine.
 
Context is thread-local, though.
 
Yeah, that helps a bit.
 
This was one of my post on the Vim mailing list when I was overcaffeinated back in 2007. I find it amusing to read now.
 
8:59 PM
How do I view the source HTML in Firefox?
 

« first day (372 days earlier)      last day (4562 days later) »