« first day (518 days earlier)      last day (4431 days later) » 

12:00 AM
Yeah.
 
@MooingDuck yeah, means it doesn't have external linkage
 
namespace { things_go_here } has the same effect.
 
@RMartinhoFernandes do they violate the ODR if they're in a header, or does each TU actually get it's own variables to play with?
 
So the bottom line is that if I have a class with a public static member, I need to have exactly one line of code in a .cpp file that defines it?
 
@Maxpm yes (good thing most headers have a matching cpp eh?)
 
12:01 AM
@MooingDuck each TU gets its own variable to play with
 
@MooingDuck Ow. I don't think it violates it, because #include is a copy-paste job.
 
@je4d sweet deal
 
But get ready for Cow-worker Curses and Endless Rage Towards You.
 
That seems a bit...unmanageable, but I guess a public static member is kind of useless.
@RMartinhoFernandes ™?
 
here's a question
 
12:02 AM
@RMartinhoFernandes I was thinking how asserts have the file name at every assert and MSVC doesn't pool strings by default
 
can I make HTML links that link to a specific part of another HTML page?
 
@Maxpm It's not useless. It's like a global variable, but associated with the class.
 
I mean, like, not just a specific line or div or something, but a specific word or phrase?
 
@DeadMG Yes. Put an anchor with a name attribute.
 
@DeadMG wait what?
 
12:03 AM
And then use the name as a fragment: www.foo.com/blah.html#namegoeshere
 
can I use that to highlight individual words, for example?
 
@DeadMG I think not. Only anchors.
 
@DeadMG highlight? What are you doing?
 
damn
 
12:04 AM
(Unless the browser does so, but none that I know of does)
 
@DeadMG you can use a frame and javascript to do highlights
 
I want to link parts of my specification to parts of my grammar
but obviously each individual entry in the grammar is it's own grammatical entity and I want to refer to that
 
@DeadMG lots of anchors
or maybe some crazy javascript on the target page
 
Anchors should work, if you can do without the flashy effects.
Otherwise, brace yourself for JS.
 
Or PHP- *shot*
 
12:05 AM
PHP is not client-side.
 
well, sure, I don't care so much about effects, all I care about is that I can clearly indicate which exact non-terminal or terminal I'm talking about
 
string pooling literals is totally safe in C++11 right?
 
@MooingDuck It is in C++03, too. I know that VS has an option for it.
 
@RMartinhoFernandes I was referring to using PHP to generate a bunch of anchor boilerplate from an array of grammar parts. The same could be done in JavaScript.
 
12:06 AM
That's why they're const bw.
 
@DeadMG I was wondering why MSVC10 still has that default to "off"
 
@MooingDuck Maybe it means extra work for the compiler? Though I can't see that being too costly.
 
@RMartinhoFernandes I'm thinking maybe backwards compatability. It compiled on MSVC6, so it must still compile :/
 
in my Wide parser, I pool all the string expressions
 
Oh, that thing.
Putting "potassium" in a pool sounds like a bad idea.
 
12:08 AM
@RMartinhoFernandes nah, it's an awesome idea
 
huh, I just saw a commercial for Google+, that showed nothing but video chat. Does Google+ have video chat?
 
Just don't get in the pool with it
 
it just dawned on me that Humans need potassium. How does our body handle that?
 
by binding it to other chemical compounds
 
@je4d Erm, it ignites the hydrogen it generates. Even if you don't get in it, you may burn stuff you don't want burned.
 
@MooingDuck It's not raw potassium. It's molecules with potassium and other shit.
 
@StackedCrooked you have a non-default constructor
 
@MooingDuck Not a problem.
 
@MooingDuck I see. Makes sense.
 
@StackedCrooked You don't have a default constructor.
A subtle difference.
Non-default constructors are allowed.
Just add binary_concat_t() = default; and it works.
 
Duck: 3
R.Martinho: 99999999ERROVERFLOW
 
@StackedCrooked You can't have user-provided default constructors.
 
@StackedCrooked = default
 
I shall now link to this:
 
However, I'm surprised that the alignment is OK.
 
25
A: What are Aggregates and PODs and how/why are they special?

R. Martinho FernandesWhat changes for C++11? Aggregates The standard definition of an aggregate has changed slightly, but it's still pretty much the same: An aggregate is an array or a class (Clause 9) with no user-provided constructors (12.1), no brace-or-equal-initializers for non-static data members (9.2),...

 
@StackedCrooked for nothing but char? what alignment?
 
Erm, yeah, that will have padding if you use something other than char.
 
12:16 AM
either way, I'm off
 
@RMartinhoFernandes You can't spell "potassium" without "pot" and "ass".
 
@MooingDuck I have three structs which have non-aligned sizes: 17, 20 and 23. So I would expect that the struct that ends up containing them as members would have padding added.
 
It doesn't get it because alignof each of the structs is 1, 1, and 1.
So the alignof the full thing is 1 as well.
 
@StackedCrooked the alignment of a struct is the same as the worst of it's members. So each of your structs has the same alignment as a char.
 
12:17 AM
@RMartinhoFernandes Wow I didn't know that.
 
hey
Where to find this password to unlock private key git?
 
@RMartinhoFernandes Was this also in C++03?
 
@hey Only you can/should know it.
 
hey
after you write git push -u origin master
 
@hey only you can know your password
 
12:18 AM
@StackedCrooked Yes (except there was no alignof to test it).,
 
@hey you'll have to make a new account/password I guess
 
hey
where is that password? how to set it? it's not account's password
 
ssh-keygen
There's a tutorial on GitHub somewhere.
 
29 mins ago, by sehe
@hey it's the passphrase you chose when using ssh-key-gen
 
This is safe, right?
char const* foo() { return "Hello World"; }
 
12:28 AM
Yes.
 
hmmm
to allow or disallow something like throw 5;?
I don't want people to throw integers, but I also don't want that inheritance-gasm you get from .NET/Java/D
 
Allow only throw 42;, throw 17; and throw 23;. That's what I use.
Now being serious, either make it anything, or give a way to tag some type as throwable.
If you don't like inheritance... I don't know what else the language offers for this tagging.
 
actually, that's a genius idea
why didn't I think of that?
 
12:43 AM
Are you being sarcastic?
 
no
 
Ok, thanks.
 
of course I possess the ability to perform tagging- it's trivial, just insert a member variable in the type structure
the question is what to tag as throwable and what to not tag
can you throw a std::vector?
 
You could want to collect several exceptions and throw them all at once.
Say, a function that fires up several threads, and more than one fails. Reporting all the exceptions sounds like a good idea.
 
true true
 
12:46 AM
Sure, you can always use a dedicated "exception collection" type for that.
 
I guess that I can defer that decision until implementation-time, as it were
 
1:11 AM
you know
my documentation of like, the "if" statement, is like, three lines
is that a bad thing?
 
It's an if ffs.
 
true true
I guess that just means I can have a more readable specification than the C++ Standard
 
I don't know how complex is the specification of if in C++, but it probably gets a bit involved because of the conversions to bool and all that.
 
eh
all I said was "explicit conversion to bool"
the conversion rules can be documented somewhere else
 
Hmm, if I want to implement an ostream, what's the minimal implementation?
Something with streambufs?
When I redesigned the CS dept site at my uni I left a message for future maintainers. Years later it's still there: http://bit.ly/yuwunD
 
1:28 AM
Arial as a first font? gross
 
Oh, you're reading the actual CSS?
 
Yes
although TBH the web leaves few choices of good fonts
 
Apparently it used Comic Sans at some point...
 
*twitch*
yay for using selectors properly and not having class all over the place
 
I'd rather read Arial than something like Times New Roman when reading off a computer screen
 
1:31 AM
I usually list helvetica first out of principle
 
@CollinHockey: Of course, not everyone has Helvetica (compared to the number of people with Arial).
 
My web developer friend has pushed some of his font snobbery on me
@Insilico Of course, it usually ends up being Helvetica, Arial, sans-serif for me
 
To hell with serifs.
 
@CollinHockey: Yeah that's what I have for all of the webpages I make (which isn't a lot).
 
(I admit I actually like Georgia quite a lot)
 
1:35 AM
My general rule is to use sans-serif for computer screens and serif fonts for anything that will be printed
 
I once liked building websites, then I realized web programming is mind-numbingly boring
5
I'm not cut out to be a RoR or new wave web framework guy
 
I also think so
 
@RMartinhoFernandes (I'm assuming this code is actually yours) You should hunt down and yell at jenn for her only comment being "Added by jenn 2011" when your CSS is beautifully formatted and commented with proper usage
 
No, it's not my code.
 
whatever you decide to call it
not really markup
 
1:43 AM
Ooops.
 
hmmm
I have a rather horrific problem that I suddenly realized I inherited from C++, and didn't notice cause it was in a different place
 
0
Q: function pointer to the main() method ( function ) MS/C++

user1131997I'm working on MS C++ compiler, and have done the next program: #include <stdio.h> void main(void) { void(*ptr)(void) = &main; } I wanted to make a pointer on main() method/function, but has got the next error: error C2440: 'initializing' : cannot convert from 'int (__cdecl *)(...

 
@DeadMG Mwhahahaha.
 
T()- a fresh instance of the type T, or a definition of the function type taking void and returning T?
can't believe I fell into that trap :(
 
1:50 AM
OMG, MVP?
How could you?
 
well, it's in a different place, so I didn't notice
it's like, std::function(int()), or x := int()
man, every time I think about this grammar, the picture just gets worse
 
What about using different symbols for object creation and function types? Say, {} vs ().
 
I have too many language semantics and too few keywords/etc
 
Hey, that's your fault. You've been killing keywords like there was no tomorrow.
 
heh, yeah#
but none of the dead ones deal with the new semantics, so :P
evidently I need to introduce new ones
hey
I haven't killed that many keywords
mostly to do with templates
and some of the primitive types
 
1:54 AM
But, but, poor typename...
 
lol
don't need it anymore :P
 
Luckily we don't need it all over in C++ too.
 
although, ironically, typename would serve to disambiguate this specific sub-problem
 
All hail template aliases.
 
man, I so badly WTB template aliases
 
1:56 AM
WTB?
 
want to buy
 
so
yet another re-engineering of DeadMG™'s grammar! :P
by the way, I had some ideas about constructing the parser
I mean, logically, the parser state is a finite cyclic graph, right?
never mind
 
lol
I guess that one was rubberducked away.
 
the C syntax really isn't designed to cope with types and expressions being the same thing
@RMartinhoFernandes No, I merely realized that explaining it to the rubber duck would take a significant period of time and the idea isn't fully-formed yet anyway
 
1:58 AM
Ok.
 
and I have more pressing problems
 
Re template aliases, weren't you trying to install clang the other day? What happened?
 
@DeadMG Am I understanding that you are defining a new language?
 
no, I was merely curious if it was worth the attempt
@DavidRodríguezdribeas Yes.
 
Then, avoid the damned C grammar of declarations :)
 
2:00 AM
heh
cut a long time ago
the only thing I have that's even remotely close to declarations is e.g. pure virtual functions and functions marked as loading from DLL
 
How can you have a language with no declarations?
 
well, mostly, I cut the whole TU thing, so the only things left that need declaring instead of defining are the things which are invisible over a run-time interface
 
Well, I was using declaration in the general sense, if your declarations/definitions are the same the comment still stands. The C style of declarations is what leads to those ambiguities of the parser
 
the only ambiguity I have inherited is that construction and function generalization- that is, something like (the T() part) std::function<void()> looks exactly like std::string x = std::string()
as the context is no longer enough to differentiate them, I now have a problem which did not exist previously
 
2:05 AM
lol
that would work in most cases
except you'd have an ambiguity where a function is overloaded or templated
eh
 
@RMartinhoFernandes Well... If I remember correctly haskell infers most but not all the types...
 
maybe I'll just cut T() as a language syntax
I cut T* and T& too
now you can have something like T.as_function_type(args)
 
What I was suggesting is that if you reverse he order then things become much simpler
 
and the flexibility of my own language continues to surprise me
 
@DavidRodríguezdribeas Yeah, occasionally you do need to make the type of something explicit to cue the compiler to infer the whole thing. But that's quite rare though.
 
2:07 AM
@DeadMG > and the flexibility of my own non-existing language continues to surprise me
 
like std::function< ()void > is a function that takes no arguments and returns nothing
 
FTFY :)
 
lol
the truth, it humbles me
 
@DavidRodríguezdribeas That's what Go did.
 
now I still have some other ambiguities to worry about... I think
right
 
2:08 AM
@DavidRodríguezdribeas I believe Herb Sutter mentioned that he would like to have this in C++ (if I understood him correctly)
 
I need to fix the function grammar because it's still broken
 
More of a wish than a real option, it is quite a radical change to the language. Actually part of it has been done already (for functions you can reorder):
auto f() -> int
 
the problem is
functions have to do way too much
they have to have two sets of arguments, and two function bodies, and a return type, and they're admissible in most combinations
 
Why two bodies?
 
What do you mean that functions need to have two sets of arguments and function bodies?
 
2:11 AM
well
the original plan for the new body was to serve as a spot for SFINAE and such things
 
@DavidRodríguezdribeas "Template" arguments and "normal" arguments. I don't know about the bodies.
 
instead of crapping around with SFINAE, you could simply enter arbitrary compile-time code to execute as a kind of prolog
and you could throw exceptions like hard error, overload resolution error, etc
 
@DeadMG What? You are suggesting prolog?
 
Like D's if?
@StackedCrooked lol
 
@StackedCrooked No, a prolog as in "A thing that preceeds", not prolog as in PROLOG
@RMartinhoFernandes No.
 
2:13 AM
Isn't that "prologue"?
 
probably
it was intended to be much more arbitrary than that- like you could perform exception specification logic too, and you could set other things like the calling convention, export name, etc
instead of compiler vendors having to introduce things like __declspec
 
@DeadMG What type of language are you thinking on? I mean, statically/dynamically typed? dynamic typing?...
You could resurrect concepts :P
 
@DavidRodríguezdribeas Absolutely statically typed.
@DavidRodríguezdribeas Concepts are a footnote in what I have designed
 
And let me guess: strong as well?
 
yeah
 
2:14 AM
@StackedCrooked Weak typing is for wussies.
 
Yeah, we don't do that around here.
 
well
 
@StackedCrooked Sadly, we do.
 
whilst I think that dynamic typing is bad, I think that weak typing is much worse
 
C++ has lots of weak typing.
 
2:15 AM
of course, this doesn't prevent a language from exhibiting both..
 
The safe-bool idiom is gone, but it was a testament to that.
 
Yeah I know..
 
true
 
How do you want to implement the *overload resolution error*, chain the options on the calling side?
f(x) ---translates-into--->
if ( overload_resolution_error(f_1(x)) )
if ( overload_resolution_error(f_2(x) ) ... ??
 
but I eliminated virtually all of the implicit conversions
 
2:16 AM
But weak typing has a benefit. Non-explicit constructors can be very handy.
 
@RMartinhoFernandes If you mean that you can use weak typing, I agree, if you mean that you need to use or you even should use weak typing I don't quite agree
 
@DavidRodríguezdribeas No. More like first, match the parameters, and then instantiate all those functions, eliminate the ones whose prologs throw the given exception, then perform best-fit match on the rest.
 
@DavidRodríguezdribeas Sure, but the important part is that you have to actively tread around it.
If you're not careful, BAM, landmine.
 
@RMartinhoFernandes I expect that in Wide, I will make explicit the default.
 
2:18 AM
after all, there's generally less justification for it when you don't have to deal with things like const char* and array decay
 
@DeadMG throw is a runtime concept, while instantiate is a compile time one, as overload resolution itself
 
@DavidRodríguezdribeas Not in Wide, buddy.
 
@RMartinhoFernandes Do you? I don't remember the last time that I used weak typing, unless we are referring to different things... maybe I am just too used to it and don't realize :P
 
Does defining operator T() make your interface weakly typed?
 
@DavidRodríguezdribeas No, I mean, you have to avoid it explicitly. struct foo { foo(int); /* oops */ };
 
2:21 AM
if you're in C++ and it's implicit, then yes :P
 
It's opt-out, not opt-in. That's the problem.
 
oh, yeah
in Wide, I will define that you may have two user-defined implicit conversions, not one
 
@RMartinhoFernandes Uhm... I don't quite consider that weak typing. The conversion might be surprising, but the type is known
 
Weak typing is all about the conversions.
 
rarely but supremely useful, two user-defined implicit conversions
 
2:23 AM
The type being known is static typing.
@DeadMG Breaks zero-one-infinity rule.
 
I guess that I would have to review the concepts, maybe my understanding of weak typing is not the common idea
 
nah, I have a specific reason for it
it's not arbitrary
imagine that you want to convert to a type which must be dynamically allocated- like, let's say, const char* for some legacy API
what are you gonna do? cause you can't deallocate it later
so I figure implicit conversion to a UDT which does deallocation in destructor -> implicit conversion to real type
else there is no way to perform additional cleanup on the resources of conversion targets
 
funny to hell, intersting what those symbols ( in &main ) are?
http://cs301611.userapi.com/u166985150/-14/y_39dacdc3.jpg
 
@DeadMG Make an explicit function call, since that might not be good implicit behavior.
 
I find that strong vs weak typing not clear. An example of weak vs strong typing whether or not you can append a number to a string using operator+=. In JavaScript you can so it's weakly typed. In Ruby you can't because it's strongly typed. But what if you define the overload string::operator+(int)? Is it then still strongly typed because the overload had to be added explicitly?
 
2:30 AM
@user1131997 Random data? Or the compiled main
 
@Potatoswatter Eh. I'm more of the "string should implicitly convert to const char*" crowd
 
Two commonly used languages that support many kinds of implicit conversion are C and C++, and it is sometimes claimed that these are weakly typed languages. However, others[who?] argue that these languages place enough restrictions on how operands of different types can be mixed, that the two should be regarded as strongly typed languages. PHP and Perl are two examples of weakly typed languages. From wikipedia
@DeadMG So there should be an explicit conversion from const char* to std::string??
 
The details of implicit conversion semantics are mainly important when interfacing templates to overloaded non-template functions. That's the case when you don't have a choice. IMHO, aesthetics be damned.
 
@DavidRodríguezdribeas where in debug window &main -> "and here some strange symbols"
 
@DavidRodríguezdribeas What? There is already an implicit such conversion.
 
2:33 AM
> One of the more common definitions states that weakly typed programming languages are those that support either implicit type conversion, ad-hoc polymorphism (also known as overloading) or both.
^ Overloading is weak?
 
it is an implicit conversion, not an explicit one
 
no way
 
@user1131997 VS is reporting the wrong type for &main. It should have the same type (pointer to function) as the other variable you're showing. Wrong type => nonsense information.
 
@DavidRodríguezdribeas What makes you think I'd be in favour of an explicit conversion only from const char* to std::string?
@Potatoswatter I don't believe it's legal to take the address of main?
 
@DeadMG He's doing it in the debugger.
 
2:35 AM
ah
 
0
Q: Does it make sense to reuse destructor logic by using std::swap in a move assignment operator?

Billy ONealConsider the following: class Example : boost::noncopyable { HANDLE hExample; public: Example() { hExample = InitializeHandle(); } ~Example() { if (hExample == INVALID_HANDLE_VALUE) { return; } FreeHandle(hExample); ...

 
well VS don't care if you break the Standard rules for main anyhow
 
What do I do when I need singleton?
 
@DeadMG There is a reason for providing only one of the conversions as implicit. There be dragons in implicit conversions on both directions
 
what dragons?
 
2:37 AM
That is what I was trying to recall...
At any rate (not related to the double implicit conversion, but just an implicit conversion to const char*), consider if (str); str += 5;` as of the double conversion many operations that make sense now would not work: str < "a" str == "a"...
 
@Pubby Shoot yourself!
 
@RMartinhoFernandes Other than that?
 
suddenly your extra implicit conversion seems to require more disambiguation and explicit types than not having it....
 
@Pubby Stab yourself.
 
@Pubby What type of question is that? If you need it, then... well, use it?
 
2:42 AM
@DavidRodríguezdribeas But I do not want to inflict bodily harm on myself!
 
(then again I am one of those that does not consider the pattern the source of all evil, and I have already had this argument here before... together with goto is a fine tool where it makes sense)
 
For what it's worth, you could only allow UD conversion to chain if the conversion is to a builtin type. No magic numbers, and it generalizes MG's case.
Also eliminates the potential combinatorial explosion.
 
Quiz question: std::bind( &f, a ), assuming that a is of a type that does not implement move construction. How many times is a copied? (no right answer, just a curiosity of the different implementations)
 
Wait, no, there might not be a combinatorial explosion but it would still not play well with efficient overload lookup.
 
Hi everyone,
quick help, how do I concat two char * in C ?
itś been a long time that I code in C
 
2:46 AM
@DavidRodríguezdribeas 2-3, depending if f takes it by value or reference. Or maybe unlimited more for inefficient implementations. (?)
@ValterHenrique strcat
 
Hell++ copies it 257 times.
 
Considering only the creation of the functor, not the execution of the call
 
@Potatoswatter I try but not working
 
@ValterHenrique Like herding cats?
 
@Potatoswatter sorry, I don't understand what you mean
 
2:49 AM
If one of them is in a buffer large enough for both, strcat; otherwise allocate a buffer big enough for both, strcpy or snprintf them in.
 
strcat( strcpy( malloc( strlen( a ) + strlen( b ) + 1 ), a ), b );
 
@Potatoswatter Gcc 4.6 (I just tested) copies only once (which is what I expected), boost::bind copies 4 times, VS copies 7 times.
 
'a' is what gonna be the result of the operation ? or is what I want to concatenate ?
 
The result needs to be stored in a variable.
And freed later.
 
2:53 AM
@DavidRodríguezdribeas GCC 4.6 has proper perfect forwarding. && to the rescue!
 
@Potatoswatter [something utterly stupid]
Where does perfect forwarding come into play? I don't think you need && to implement bind with a single copy
The in-house implementation I read today makes one copy, but I believe it can be avoided
 
Hmm, yeah, you're right. const & is good enough in this case.
 
@DavidRodríguezdribeas How can it be avoided?
What if a is a local variable? Isn't bind supposed to "bind by value"?
 
here is my question about this issue guys
http://stackoverflow.com/questions/9746866/how-to-concat-two-char-in-c
 
(And thus, the reason std::ref exists).
 
2:58 AM
thank you by your help
 
Think he meant one additional copy
 
Morning.
 
@RMartinhoFernandes Sorry, I meant 2 copies and one could be avoided
 

« first day (518 days earlier)      last day (4431 days later) »