« first day (494 days earlier)      last day (4463 days later) » 

12:01 PM
> A trap representation is accessed by an lvalue expression that does not have character type
what the heck is a "trap representation" in C?
this is from the C UB list
 
Xeo
@TonyTheLion signaling NaN, for example
Or any pointer value the implementation wants to trap
 
Lol, I changed my meeting area so the dogs all flocked to it. Now I've assigned them to the pen, and they have to be hauled one by one back there.
 
12:16 PM
Hi there all.
 
@TonyTheLion one which, when read by the CPU, causes a hardware exception
 
ah ok
 
sbi
What's that thing that's like Photoshop except way easier to use and it's for real life? Oh yeah, vodka.
 
sbi
12:26 PM
"C++ was too complicated for me, so I learned assembly and I love it." Random quote from a #StackOverflow profile
@CheersandhthAlf What the hell are you talking about??
 
@sbi lol
 
Assembly isn't complicated at all.
 
Xeo
@daknøk Yeah, but it's fucking ugly.
 
It's less ugly than C++, at least.
 
Xeo
And non-portable.
 
12:29 PM
That's true.
 
@sbi make a guess?
 
@R. Martinho Fernandes in your SHA implementation on Bitbucket (wheels), why are you using unsigned char instead of uint8_t, if I may ask?
 
sbi
@Xeo Well, that's what C was invented for: a portable assembler fitted to machine architectures of the late sixties. The problem is that this fact got mostly forgotten, and programmers started to treat it as if it was a real language that's still usable 40 years later. Some crazy Scandinavian even based an insanely complex multi-paradigm language on this portable assembler, and it's been thriving for 30 years.
3
@CheersandhthAlf Uh. I see no mods here anymore? And even that guy from the SO team is gone? Is that it?
 
@daknøk Because that code is old and it should really use uint8_t :)
 
12:36 PM
@RMartinhoFernandes I see. d:
 
sbi
@CheersandhthAlf Did you just happen to note this or was there something that prompted you to point it out?
 
Thanks for noticing. I'll have to look at it again.
 
An std::bitset may also be appropriate here instead of an array.
 
@sbi it just felt like now it's been long enough that we can trust it. like an hour. :-)
 
@sbi: I think you are wrong. C stopped being portable assembler with the first standard.
What is wrong is that people still treat it as such even after the standardization.
 
sbi
12:39 PM
@CheersandhthAlf As I had said before: I preferred it when we knew who was a mod. Now, any of the users currently in the room which I had never heard about might be a mod's sock puppet.
 
oh, no, i don't think they do that
even when will delete my one word "Measure" answer (which was a really stupid thing to do), he identified himself
 
@CheersandhthAlf and if they do, they could do that while there were "public" mods here too
 
hey, now you guys sound like noia
and that's not a type when i tried to write nokia
i think the situation is like this: there's something wrong somewhere, so that mods engage in deleting discussion and whatnot, but, as most politicians they try to do the best for the people they serve
 
sbi
@wilx You might want to take the time to work through this document by Ritchie. This made me understand how much of what we take for granted today were arbitrary decisions back then based on what would be convenient to write Unix for architectures that were popular back then.
> NOIA is the only national trade association representing all segments of the offshore industry with an interest in the exploration and production of both traditional and renewable energy resources on the nation’s outer continental shelf. NOIA’s mission is to secure reliable access and a fair regulatory and economic environment for the companies that develop the nation’s valuable offshore energy resources in an environmentally responsible manner. — www.noia.org
@CheersandhthAlf ??
Oh, and:
I just spent 2hrs in a stupid meeting and have had enough of this Can we not to skip the rest of it and go straight to tomorrow? #justasking
This might explain me being a bit dense currently.
 
@sbi to cite heinlein: a paradox can be paradoctored. i meant "paranoia"
"pair of docs" -- get it? he he :) :) :)
 
12:49 PM
@sbi Intriguingly, this is from the same user profile:
> I know PHP, JS, CSS, and HTML
And apparently he isn't big on physics either:
-3
A: Do gravitational waves slow down as they pass through matter?

andrewjacksonYes, because matter has it's own gravitational pull.

 
@CheersandhthAlf my problem is that they serve the wrong people
 
@daknøk It's just using it effectively, where it gets complicated. Just like VB6, C, Java, C++, Haskell, and several other programming languages, really
 
@sehe perhaps just as light slows down depending on the watchamacallit constant of the medium (di-electric constant?), perhaps gravity waves also slow down depending on the medium?
 
I'm sure they have the best intentions, but the only people they try to serve are those on meta. And they do this by imposing their will onto SO
 
12:55 PM
@CheersandhthAlf Refractive index?
 
@sehe I see there are lots of answers that say no based on a math model, but the fact is that nobody's yet measured or detected any gravitational wave. one can only say that the general relativity is consistent to umpteen decimal places with e.g. neutron stars emitting such waves. but until they are detected, talking about them as real, not to mention their detailed properties, seems to me to be over-confident, hubris.
 
@CheersandhthAlf & @RMartinhoFernandes en.wikipedia.org/wiki/Refractive_index#Dielectric_constant
@CheersandhthAlf I wasn't really reading much into the answer. I was really pointing at the user profile as it was subject of a tweet.
 
0
Q: C2059: syntax e r r o r : ';'

Manav DhimanHaving a really small problem. This is a pointer program I tried to make for practice, but I'm getting a error in Visual C++. #include "stdafx.h" #include "iostream" #include "string" using namespace std; int _tmain(int argc, _TCHAR* argv[]) { char *p = "School"; char c; c = ++*p++...

 
@CheersandhthAlf Yeah. The mixup between theory and reality may be lurking there. In general, physicists are usually less prone to that pitfall than say mathematicians, or dare I say, computer scientists
 
lol
 
12:59 PM
@sehe (^^ <-- dare I continue that this room is frequently providing empirical evidence to support my conjecture)
 
@sehe uh, which conjecture? sorry, i don't recall or haven't seen or didn't grok
 
@CheersandhthAlf Gravitational waves (or at least the effects thereof) have been observed in said neutron star systems.
 
Often, the only possible "evidence" (as far as there can be 100% proof something is the way it is described) is indirect, and hard to interpret without the theoretical background.
 
@daknøk imagine how much easier it'd be to learn C++ if we didn't have this urban myth that you had to do things like "write pointer programs"
 
1:04 PM
@CheersandhthAlf note: "In general, physicists are usually less prone to that pitfall than say mathematicians, or dare I say, computer scientists"
 
sigh
 
@jalf pointer programs. sounds like fun
 
++*p++ + *p++ + *d-- + &a + --*c-- pointer programs! :D
Like C.
 
@sehe Doesn't that question belong on SU in the first place?
 
@KillianDS well. you decide. I didn't think so, shell programming is still programming. He doesn't say that is doing a sysadmin task. He might be doing a cgi website for all I know
 
1:19 PM
K, my turn is done. Who was next? @MooingDuck?
 
@jalf @daknøk Pointer programs are fun. Guess what language this is:
using System;
class MainClass {
	unsafe public static void Main (string[] args) {
		fixed (char* r = "helloworld".ToCharArray()) {
			char* p = r;
			while (*p != 0)
				Console.WriteLine("{0:X}", (int) *p++);
}        }       }
 
@sehe C#.
 
@daknøk And will it work? (Re edit: lol, nearly flunked it)
 
@sehe I don't know C#, so I don't know.
 
@daknøk A lot of experienced C# developers wouldn't know it when they were forced to decide 'yes'/'no'
 
1:22 PM
I don't know the operator precedences of suffix ++ and prefix * in C#.
 
The output: 68 / 65 / 6C / 6C / 6F / 77 / 6F / 72 / 6C /64
 
Also, define "work". :)
 
@sehe but the whole pointer mythology isn't exactly helpful to people trying to learn the language
 
@daknøk It does work, provided unsafe code allowed. I.e., it won't on ideone, but it will on your local PC if compiled csc /unsafe test.cs (ideone.com/vhBnZ)
@jalf derp. I know that :) C++ has a lot to learn from the C# community. Perhaps D is step in the right direction? <ducks/>
 
brb gonna get something to eat
back
 
1:28 PM
Hey c++ fans!
 
ugh, fans?
 
anyone here that understands RunPE and injection to process?
 
@rubenvb thanks for the info. my point was simply that a mathematical model is no firm ground even if it works superbly for a few cases. in particular, the simple math model that we have of gravity, fails to explain the speed of the outermost stars in our galaxy; they should be jumping ship, so to speak. that was known since the late 1960's. today, instead of recognizing that Something Smells Strongly (SSS), they make unfalsifiable theories like MOND and dark matter to account for the speeds
 
@sehe The C++ community has a lot to learn imo. My point is that it's not the language that requires you to understand pointers from day 1, it's all the crappy C++ textbooks, and this whole urban myth that "you're not a real manly C++ programmer until you understand pointers"
 
@jalf pointers should be one of the last things mentioned in beginner C++ books. If at all.
Also: references first.
 
1:32 PM
@jalf Ever decreasingly so. I think Stroustrup, Andrei, Herb (in that order) made a pretty clear case for that in GN2012
 
@sehe yeah, the books are getting better, but there's still the whole folklore/mythology around it. People who aren't already C++ experts think pointers are important
 
@daknøk Mention you should. Practice how to manage, not so much. Practice spelling unique_, shared_ and friends - and say with andrei/STL: "da da da... stodd ...pooter ... stodd ...pooter ... da da da"
 
That's starting to sound like a children's song.
 
Didn't think of shared pointers. Extremely true!
 
@jalf I think understanding references vs. values, conceptually is key.
 
1:35 PM
@jalf Also, do not forget that many people learn/heer of C++ from other channels (books that do not cover C++ directly, web tutorials, lousy university classes, ...). If it were only for the books it would be a much easier task to set things straight
 
@KillianDS yeah
I wonder if fuckpointers.com is free. Would make a nice domain for a C++ tutorial
 
Imagine for a second how easy it'd be to learn C++ if people would just shut up about pointers for 5 minutes
 
@sehe Interestingly, the chasm between ValueType/reference types in CLR is also a common tripping point for .NET developers both green and seasoned.
 
Well said. (:
 
1:37 PM
> Imagine for a second how easy it'd be to learn C++ if people would just shut up about pointers for 5 minutes (jalfd)
5
^ just as star-bait. +1
 
@jalf domai.nr/fuckpointers.com it is (: And why a tutorial, why not just a free, wiki-like book?
 
Xeo
1:50 PM
@RMartinhoFernandes What'cha doing?
 
robots eat?
 
Xeo
@TonyTheLion A bit here, a bit there.
He's byting into some delicious code.
 
So, R. Martinho Fernandes, you eat C++ for breakfast?
 
Xeo
1:58 PM
Clang eats C++ for breakfast.
 
I eat/drink Chinese tomato soup for breakfast.
 
Xeo
Sounds yummy
 
Joined twitter not even half an hour ago, already got mentioned in a spam tweet.
Specifying that the returned value of std::type_info::name() is implementation defined makes it completely useless. What's the point?
 
2:13 PM
@daknøk Debugging. :)
you can get some name for a type which is as descriptive as the implementation makes it
 
@jalf ever tried it w/ clang? :P
 
@daknøk He's a robot, he doesn't really eat.
 
Xeo
@daknøk Not restraining the language to certain implementations that are able to give an exact representation
 
@daknøk what would you use it for if it wasn't implementation-defined?
 
If it would return a meaningful value, e.g. the class name, it would be handy when implementing an ORM or something. class name = table name.
 
2:15 PM
What's the best build automator?
 
@daknøk What about column names?
 
@RMartinhoFernandes an std::map that's set in the constructor.
 
Erm, if you're doing that by hand, you might as well write the class name too.
 
Xeo
Hrhr
 
:P
 
2:17 PM
@daknøk What's the class name of decltype([] {})?
What about namespace { struct foo {}; }?
 
Most ORMs I know let you handle the mappings yourself.
 
fair enough
 
Xeo
@LucDanton No lambdas in unevaluated contexts! :P
 
Then again, I only know NHibernate and EF.
 
at least it's implementation-defined and not completely unspecified. So you can rely on it for any given platform
you just can't rely on it in platform-agnostic code
 
Xeo
2:19 PM
RTTI sucks anyways
 
@LucDanton I think the only requirement for lambdas is that they're implicitly convertible to std::function (and that the non-capturing ones are implicitly convertible to function pointers). But their type is implementation defined.
 
@Xeo You failed the test. Obviously auto f = [] {}; using now_what = decltype(std::bind(f)); is still problematic.
 
@LucDanton I think that's what the :p was for ;)
 
Xeo
@EtiennedeMartel Not convertible to std::function from the lambda side
 
@Xeo Ah, yeah, indeed.
 
2:20 PM
@EtiennedeMartel They are of class type with an operator() (which means you can legally take its address and inspect its type, too).
 
Xeo
A lambda is just another function object, aka a normal class
 
@EtiennedeMartel implementation-defined but unique.
 
brb going to install a new wallpaper
 
Meh, wallpapers. Just painting the wall is better.
 
Xeo
Paint it with blood.
 
2:27 PM
And then send engraver in.
 
Xeo
Needs about 4-5 first borns for a nice, deep red.
 
One time, just one time in my life, I want to write my homework with blood and see what my teacher thinks of it.
 
There's a programming language called "blood"?
 
They probably won't notice.
Unless they're a vampire.
 
They ask "why did you write it in red?"
I say "blood was the only ink I had."
 
2:29 PM
"Why is the second half missing? — I ran out of virgins."
 
:P
 
Xeo
@CatPlusPlus And first borns
 
Who compiled Clang?
 
I did, a few days ago.
 
Xeo
Me
But not on Windows. :P
 
2:30 PM
I refer to the topic, silly people.
 
I know, I'm trolling.
 
Xeo
Then I refer you to the starboard
 
Compile GCC with MSVC. Then I'll be impressed.
 
Does the AST generated by clang include comments?
 
Probably not.
Preprocessing is most likely done before doing AST.
 
2:32 PM
The lexer has an option to not ignore them, though.
 
OTOH, they have an open project for documentation generator.
So maybe.
 
does anybody know if ARM architecture does an atomic write of a int type?
 
Xeo
The AST has source-ranges though, and when printing a diagnostic, the printed code is directly taken from the source
 
Read ARM manual?
 
@TonyTheLion byte and word quantities.
 
2:34 PM
@CatPlusPlus Chop your leg with a rusty axe, then I'll be impressed.
 
@daknøk ah, so a 32bit type would not have an atomic read/write?
 
I like my leg.
 
@CatPlusPlus I like my sanity.
 
@TonyTheLion depends on the byte size or word size.
 
@EtiennedeMartel What are you doing here?
 
2:35 PM
@CatPlusPlus I got surprisingly high resilience to insane shit.
 
Why is chat still brokeeeeeeeen. Nobody reported that double notification thingy?
 
Yummy, rookworst.
 
2:51 PM
@CatPlusPlus double
@CatPlusPlus notification?
 
@DeadMG Yes. Plinks and shows the window twice for every message.
 
Try reloading the page.
 
Robot had that problem, too.
 
I only got one plink when you replied to me just now
 
2:54 PM
@DeadMG On Chrome?
 
yes
 
user406009
3:06 PM
0
Q: Dynamically allocate memory for struct

sircrispI am taking a C++ class and have a assignment which requires me to dynamically allocate memory for a struct. I don't recall ever going over this in class and we only briefly touched on the new operator before going on to classes. Now I have to "Dynamically allocate a student and then prompts ...

 
user406009
Someone is asking for a trip into the dark world of pointers.
 
Hmm....
 
new my_struct; isn't so dark
 
he should probably use smart pointers.
 
user406009
@StackedCrooked You are forgetting the memory leaks.
 
3:09 PM
Phew, at least @DeadMG is in there to show these idiots that using raw pointers is not a good way to do modern C++.
 
yeah, I downvoted nearly every other answer for that T* t = new T; silliness
 
@DeadMG I feel like we are some sort of ancient order who move things behind the scenes by upvoting and downvoting select answers to make sure that the right ones get accepted.
 
std::vector<my_struct> obj(1); // voila, a dynamically allocated struct :D
 
@StackedCrooked Damn, that's ugly.
 
unfortunately, it's the ancient order who does the T* t = new T; shenanigans
@EtiennedeMartel Technically, he did only ask for one single dynamically allocated Student, which is what such a thing would provide
 
3:12 PM
@EtiennedeMartel What? I didn't even write new!
 
@DeadMG Except that's not the intent you're communicating to whoever will read your code.
 
nvm, found a link
 
true
 
auto ptr = make_unique<my_struct>();
 
but that Student stuff is a pile of shit anyways
 
3:13 PM
@Pubby Don't use autoconf and m4.
That's the easiest and sanest way.
 
@CatPlusPlus I figured you'd say that.
 
0
Q: error: invalid conversion from 'bottom**' to 'lefta**'

HenryI'm trying to compile and run this program .obviously, it doesn't work!my question is why it is invalid conversion from bottom** to lefta** while bottom* can convert into lefta* ? #include<iostream> using namespace std; class top { private: int a; public: top(int b):a(b){} vir...

Moar stars!
It's amazing that people trying to do minimal examples type all that stupid private: and public: stuff.
 
It's also amazing how contrived their examples can get.
 
@CatPlusPlus I don't know what else to use. Any ideas?
 
For a build system? Anything else.
 
3:26 PM
Is memory returned by new char[100] aligned enough for any kind of data that I can put there?
 
CMake, Boost.Build, SCons, waf, premake.
 
@CatPlusPlus omg the formatting.
 
Meh, still double notifications.
It's not the cache.
 
I think I'll try out premake
 
Reboot your computer.
@Pubby premake is awesome.
 
3:28 PM
premake is rather primitive.
 
@wilx It's properly aligned for any type with basic alignment.
 
I just want something that doesn't get in my way.
 
@RMartinhoFernandes Still getting double notifications?
 
It's not properly aligned for types with extended alignment, like SSE vectors.
@CatPlusPlus Yeah :(
 
@Pubby And you tried autotools? Lol.
 
3:30 PM
@CatPlusPlus Yeah :(
 
Is else if explicitly defined in the standard or is it a side effect of curly brackets not being necessary?
 
Why would else if be special?
 
@daknøk: They are separate keywords. There is nothing in the grammar that would specify IF ELSE tokens sequence.
 
@Pubby I was just wondering, I couldn't find it in the standard. I thought I missed something.
@wilx I see.
 
sbi
3:41 PM
Every time someone wants me to sign for having given something to them I cringe, but if it's the guy who signs my paychecks, I am alarmed. After all, this shows a complete misunderstanding on the most fundamental concepts of signing and mutual trust.
 
3:51 PM
@Pubby @daknøk don't know context, but if it is c++: nongnu.org/hcb
 
I'm bored to death. Anyone ideas for a fun C++ project?
 
@daknøk Aanschuiven?
 
@sehe al op :P
And it was a Broodje Unox, by the way.
Not a stamppot.
I'm gonna write a build system.
As a static library.
 
Xeo
@daknøk Write a cross-platform dependency checker that scans a source file and prints any direct and indirect dependencies on other files already resolved to a specific path
That's what I'm currently doing atleast, and it's fun. :)
 
@Xeo and downloads external dependencies (libraries, etc) automatically from the internet.
 
Xeo
4:04 PM
@daknøk That's be hard. Very hard.
 
@Xeo nah, just runs apt-get or port :P
 
Xeo
Not that, but finding out what library to get
 
What about something like Apache Maven but for C++? Also seems fun.
 
@Xeo quite easy too, IIRC; apt repositories have an index/cross ref thing to search. Don't use it myself, but I'm prety sure it exists
 
I answered yet another simple question with a loooooong treatise, yay! :-)
0
A: Dynamically allocate memory for struct

Cheers and hth. - Alf "Dynamically allocate a student and then prompts the user for student’s first name, a last name, and A - number(ID number). " This assignment requires you to have a not completely initialized Student object around until you can update it with the information provided by the user. That is a ...

 
sbi
4:20 PM
Just changed my LinkedIn tagline to - "Professional Bug Writer." Hopefully I get fewer calls from recruiters now.
 
@sbi The fun thing is that he's just stating the obvious.
We're all bug writers.
(Amongst other things, of course)
 
sbi
@EtiennedeMartel You forgot one fact: This is aimed at recruiters. Common sense doesn't apply to them, nor do they apply it.
 
brb gonna eat
 
@sbi Interesting. Gonna need to keep that in mind in the future.
 
@EtiennedeMartel Oh, I saw a bug in the code I posted in that answer. Writing "first name" in error message about last name. Bug repeated in version 2. :-(
I'm just going to leave it.
Maybe no-one notices.
 
4:40 PM
@sbi ?? What are you having to sign for giving to the guy who signs to give you your paycheck.
 
back
 
@sbi Did you mean, having to sign to take something.
 
sbi
@Xaade Today we got issued new keys for the office, and I had to sign for giving back the old key. That's certainly hilarious, but the office girl doing this, when pointed out, said I should take it up with her boss, who made her follow this procedure. And that's the guy who signs paychecks.
 
honestly it's quite easy. Keep a list of paycheck numbers (oh wait, accounting does that), then if you have to reissue a check, cancel the old one (oh wait, accounting does that). Why are there stricter precautions for handing out paychecks to employees than there are to pay another business for a transaction.
@sbi You see, I couldn't parse the english, because it made no sense.
 
sbi
@Xaade I'm in a company with 25 employers. No, wait, at least five of them are (also?) company owners. This one guy and two girls is all the accounting this company has. And he also signs the paychecks. And he's one of the owners.
 
4:44 PM
But that's a fault of the procedure, not the english..
@sbi Then, the one guy and two girls, aren't very good at accounting.
Are they going to ask a supplier to sign for accepting a check.
And, what if the supplier electronically transfers, then accidentally cashes the check.
 
sbi
@Xaade Well, I was told he's kept the company afloat through several severe financial crises, and I'd better put up with his funny ways. Sigh.
 
Using a check and balance system on a physical check or key, instead of built in accounting procedures, just shows that they are very dated in their understanding of accounting.
@sbi Is it a Jimmy Neutron hero?
@sbi AKA, you saved us..... from you.
Glad you saved us from that rip in space-time your experiment caused.
 
sbi
@Xaade Erm. "Signing paychecks" wasn't meant literally. When I worked in the US in the 90s, I'd get a paycheck every week, and I was bewildered by that, because nobody had been doing this in Germany in what's probably the last 50 years. Here, money is put on your account at the end of the months. (Hopefully it is, anyway.)
 
@sbi Lot's of small businesses have yet to figure out that it doesn't cost anything to do a local bank transfer. If they want it really cheap, have the employees hold an account in the same bank as the employer.
Otherwise, you're wasting money on those physical checks.
But then again, old people are scared of new things.
@sbi When I was a kid, they'd write a real check out, then make you sign a sheet saying you've picked up your check. Which is bothersome, because technically you could go and do an electronic transfer with the routing number of any amount.
Whereas if they simply electronically transferred to begin with, they wouldn't have to look at their account for every single physical check.
@sbi You underestimate the number of Americans who don't have a bank account.
@sbi Read as, I'm satisfied with my job now. I only accept calls from actual bosses.
 
@Xaade stats?
 
4:54 PM
@sehe I should have them?
 
@Xaade I'm asking whether you do
 
user784668
@sehe It's Usonia. You shouldn't except it to be a civilized country.
 
I've never even seen a cheque.
 
I simply know personally more than a handful of people. And if you assume that everyone has them, then one not is one too many.
@Fanael Given the financial situation, you'd find a lot of "civilized" people have less and less in a bank these days.
 
5:07 PM
@sircrisp sounds like you really need to consult your class material. Or a good C++ book. You need to use -> to access members through pointers. – R. Martinho Fernandes 1 hour ago

Does that operator have a name? I can't find anything within pointers in my book touching on it and I don't need a whole lecture or chapter on it I just need to see it in use that is the real way I learn. – sircrisp 1 hour ago
Wow.
 
sbi
@CatPlusPlus That's because you're to young. In the 80s, they were all the rage.
> @sircrisp: Judging from this question, this is not the way you learn. – sbi /cc @RMartinhoFernandes
 
user784668
@sbi He's Polish. In the 80s, they had bigger problems than checks.
 
sbi
@Fanael You tell me. I was East German in the 80s.
 
Xeo
Tell me, I wasn't even born in the 80s!
 
Me neither. And therefore, I had no problems.
 
user784668
5:14 PM
@sbi East German? How nice! omitted the part that would cause Wessi vs Ossi war
 
sbi
@Fanael I am often taken as a Wessi.
@Xeo That was my point, no?
Anyway, gotta go home and feed a kid.
 
user784668
Can someone explain me why virtual methods should be private by default? I've read Sutter's article, and I don't buy it.
 
@Fanael I'm thinking, and I can (kindof) justify protected, but private just seems silly.
19
Q: What is the point of a private pure virtual function?

BeeBandI came across the following code in a header file: class Engine { public: void SetState( int var, bool val ); { SetStateBool( int var, bool val ); } void SetState( int var, int val ); { SetStateInt( int var, int val ); } private: virtual void SetStateBool(int var, bool v...

 
user784668
 
arggh
 
Xeo
5:32 PM
@MooingDuck No, private is the correct choice.
 
@Xeo The problem is that "simultaneously" part, because each virtual function is doing two jobs: It's specifying interface because it's public and therefore directly part of the interface Widget presents to the rest of the world; and it's specifying implementation detail, namely the internally customizable behavior, because it's virtual and therefore provides a hook for derived classes to replace the base implementation of that function (if any).
 
Xeo
@Fanael Google for non-virtual interface
 
Having virtual methods public makes it harder to enforce preconditions and invariants.
 
@Xeo he has read about it alreaedy, and disagrees.
 
It's moving implementation to Pimpl without actual Pimpl.
 
5:50 PM
in the new features for C++11, will const char* or std::string be permitted as template parameters, or do we still have to use hack-arounds?
 
No. And there are no hack-arounds.
 
Xeo
FWIW, const char* is permitted as a non-type template parameter. :p
 
I'm reading some ugly ones here (probably will not use them, tho):

http://stackoverflow.com/questions/2033110/passing-a-string-literal-as-a-parameter-to-a-c-template-class
 
@Xeo But not really usable in a decent manner :(
 
Xeo
Yeah, that's another matter.
 
5:51 PM
@Xeo maybe a dumb question, but isn't "non-virtual inheritance" the very normal inheritance?
 
@RMartinhoFernandes @Xeo thx for the sanity-check
 
Non-virtual interface.
 
Xeo
@bamboon interface != inheritance
 
Virtual inheritance is something else completely.
 
@Xeo oops, my eyes are tired
 
I think I will use CRTP/pure-virtuals to pass back those std::string/const char* - not so pretty but should work ok
 
If only we had template UDLs for strings...
 
Xeo
Shaddup. :(
Anyways, afk.
 
@IntermediateHacker Reality: nobody cares. Also, your fault for using an outdated and overused term to describe yourself.
 
5:58 PM
@CatPlusPlus damn... :'(
 
watching From Dusk Till Dawn on cable while coding - Tarantino sure knows how to go-over-the-top in these pulp films...
 
Hi guys I'd appreciate help writing the boost version of the answer to this question
3
Q: c++ template specialization for all subclasses

Abhishek AnandI need to create a template function like this: template<typename T> void foo(T a) { if (T is a subclass of class Bar) do this else do something else } I can also imagine doing it using template specialization ... but I have never seen a template specialization for all ...

Here's my error-ridden attempt -- ideone.com/Z9Cpm
 
How can you watch a movie while coding? I can either focus on the code, or enjoy the movie, not both.
 

« first day (494 days earlier)      last day (4463 days later) »