« first day (793 days earlier)      last day (4159 days later) » 

11:00 AM
room topic changed to Lounge<C++>: No one is drunk here; maybe crazy. [c++] [c++11] [c++-faq]
 
<quake3voice>Impressive</quake3voice>
 
my back is really starting to get to me :S infernally itchy, stupid healing process
 
eh, I know all about the itchy healing process
 
fuck you windows console, Y U NO UNICODE?!
hm... or maybe it's not console but wcout
 
windows console typically has the same encoding as your system
 
11:08 AM
iow, shitty codepages
 
@Abyx It's the console.
I think I need a better charmap. The one that ships with Windows is not good enough.
 
Windows console is so bad some CLI script languages ship with their own consoles
 
@TonyTheLion yeah... I have to admit, I feel some what childish complaining about it next to you :S
 
BabelMap looks nice, but still not good enough :( I want searches by something other than name.
 
oh, I bad perfect timing for stitch removal, due Christmas day :S
 
11:11 AM
And I don't want to roll my own because GUI.
Oh wait, BabelMap has advanced search after all. Woot.
 
link or it didn't happen
 
@R.MartinhoFernandes thank you :)
oooh
 
@thecoshman no worries. :) Itching is a rather annoying thing.
 
@TonyTheLion anything I can do to help besides man up?
 
11:17 AM
Manning up is for pussies.
 
:S
so... erm... I should... ah... potato?
 
@thecoshman Bear it like a man.
:)
 
-3
Q: Use of structs arrays

Lahiru LiyanapathiranaRequirements At the recent British Indoor Rowing Championships, twenty men contested the Open Heavyweight competition. The race takes place over the standard distance of 2000 metres and the time is recorded as each competitor passes 500, 1000, 1500 and 2000 metres. The winner is the rower that ...

 
@R.MartinhoFernandes Says the Robot.
 
Nuke please.
 
11:19 AM
@TonyTheLion Bear or Beer?
 
nuked
@thecoshman :P
 
Cant VTC :(
 
Launch the missiles!
 
hahahah
 
11:21 AM
@R.MartinhoFernandes ¬_¬ grumble stupid robots get's to make subtle nods towards former dictatorships grumble
 
@thecoshman What? Germans don't speak like that, French do.
 
@R.MartinhoFernandes ah, my point still stands, if you consider monarchies dictatorships :D
 
Well, maybe Xeo does, but most Germans I have talked English with don't.
 
bah, just follow it up with 'yar' and it'll be grand :P, yar
 
11:38 AM
@R.MartinhoFernandes that question abomination you linked to, I like how you can't use classes, but you can use structs... how can any one put such a limitation on you and claim to teach C++
 
Sorry guys!! i really need this...hope u give a satisfying answr — Lahiru Liyanapathirana 7 mins ago
lol
 
11:50 AM
Oh great. Apparently I also need to handle non-Unicode characters that are not assigned into the Private Use Areas. Shit.
 
@thecoshman because idiotic professors with their shitty teaching methods that don't have any resemblance to reality
 
@TonyTheLion oh yes, like those who think there is some magical difference between structs and classes :P
 
structs are better magically
 
user142019
If people just post their homework assignments exactly I flag them as offensive.
 
I don't think I said, but I will take it back anyway, build systems are more complex then I first thought. especially one that doesn't suck
@Zoidberg'-- if it was up to me, you wouldn't get to flag stuff :D
 
user142019
11:55 AM
I'm not OP's slave.
 
user142019
Also goodmorning.
 
@Zoidberg'-- nor is it offensive
 
user142019
@thecoshman I find it offensive. DO THIS FOR ME DO THAT FOR ME
 
@Zoidberg'-- technically, they are not even asking that. They just dump an assignment they don't ask for help, or ask for you to solve it
stop your bitching
 
user142019
They deem you to solve it, and that's the problem.
 
11:59 AM
yes, but it is not offensive, and you do not really find it offensive, you are just being an awkward shit
diluting the meaning of the offensive flag, thus making mods slower to respond to it, thus letting actually offensive posts sit around for longer
you jerk :P
 
@R.MartinhoFernandes No, sorry :/
 
user142019
0
Q: New and delete in multidimensional array

ChrisCan someone help me to understand this chunk of code on the part revolving the g_pPtr, new, delete, multidimensional array with the macro #define and #undef? I am adding my understanding as comment next to the code. CMyWin * g_pPtr[SLOTS][PORTS];//Pointer to multidimensional array int g_pPtrInit...

 
user142019
lol dat code
 
Meh. Seen worse :/.
 
user142019
I'm in the mood to write C++. It's been a long time since I wrote anything serious in it.
 
12:02 PM
Wait. I take it back: #define g_pPtr g_pPtr[m_nSlot][m_nPort] //define g_pPtr to point at a particular position in multidimensional array? ... #undef g_pPtr//g_pPtr now point to the first element of multidimensional array again? Wut?
 
> Does this have anything to do with the standard?
lol
2
Q: competing implicit and template copy constructors

Doru GeorgescuIn relation to this post, please explain this behavior: #include <stdio.h> struct B { B(B&) { } B() { } }; struct A { template<typename T> A(T&){ printf("A(T&)\n"); } A() { } // B b; // when this is uncommented, output changes int i; }; int main() { A a; ...

 
This question seems broken oO
 
cpx
> Nipun Jain has invited you to join Room for Nipun Jain and cpx. See your invitations.
What?
 
zomg. I see a line over all of the posts
UTF always was more like WTF
 
1 message moved to bin
This is not about UTF.
 
user142019
fatal: You are on a branch yet to be born
 
Aww yeah, it feels so good to use do while.
 
user142019
WTF GIT
 
12:34 PM
-2
Q: == or != Which one is more efficient in C, C++?

NeonGlowI am writing application for an embedded environment in C++, which is then cross compiled for MIPS platform using GCC. Since the embedded hardware have limited processing power and memory it is preferable to write code in most efficient way. There are a number of places in code where I can use...

Seriously, how many times will these be asked...
Oh, closed already. Nice.
 
Poor sod:
Okay. Can I instead ask you to drop it then? If it's not even important enough to even substantiate a claim, perhaps you should not be accusing others. Remember, this site is for helping others. I suggest you take some time to help others on this site, before throwing stones at other ---tossers--- helpers. — sehe 48 secs ago
 
user142019
fatal error: 'sstream' file not found
 
user142019
dammit
 
@Zoidberg'-- I've also run into that error many times.
 
user142019
12:51 PM
dammit libc++ y u no Linux
 
-1
A: Standard C++ method for validating a URLs format?

hshYou can call java/net/url, using java native interface (JNI).

 
user142019
hurray it works
 
@BartekBanachewicz lulz
 
wtf, everything went cyan
^does that appear white or cyan?
 
White.
Your monitor is broken.
 
12:58 PM
Replugged monitor cord and it works now :)
Although cyan vision was kind of cool
 
@Pubby You probably have a shitty connection on the pin carrying the red signal or something. :-)
 
@Insilico Yeah, that's probably what happened
 
@Pubby In a conference room where I tried giving a PowerPoint presentation someone managed to completely smash the green pin in the monitor connector or something equally idiotic.
Needless to say we just stole a cable from another room.
 
OMG you are a criminal.
 
I wish I could downvote this more. — DeadMG 4 mins ago
LOL.
 
user142019
1:08 PM
template<typename F, typename... Args>
int syscall(F f, Args&&... args) {
    int ret;
    while ((ret = f(std::forward<Args>(args)...) == -1 && errno == EINTR));
    return ret;
}
 
user142019
Is the forwarding needed? System calls are (AFAIK) all C functions and C functions don't take references.
 
@Insilico I once "borrowed" a bunch of LAN cables for my LANparty :)
 
@Zoidberg'-- No.
 
Why you no throw a std::system_error, btw?
 
@R.MartinhoFernandes Y U NO FTFY
 
1:11 PM
@BartekBanachewicz Y U NO FTFY
 
@DeadMG Y U NO FTFY
 
WTF is happening.
 
I thought it would be less amusing in this context
that's Y
 
@R.MartinhoFernandes sheepling
 
user142019
@R.MartinhoFernandes because this is merely a wrapper around C system calls which fail when interrupted by a signal (and thus need to be recalled).
 
1:12 PM
Can anyone take a look at my question? :) stackoverflow.com/questions/13914507/…
 
@Zoidberg'-- Y U WRAPPER
 
@Masochist ¬_¬ risky move
 
I don't see how that changes anything.
 
user142019
I don't see why it should throw an exception. And when.
 
"Why is your wrapper not doing the right thing?" "Because it is merely a wrapper that does not do the right thing."
@Zoidberg'-- When there is an error?
 
user142019
1:14 PM
When it returns -1 and errno != EINTR?
 
std::system_error is made for wrapping that errno crap.
@Zoidberg'-- Yeah.
 
user142019
Ah I see.
 
I actually have no idea how to use std::system_error on Windows, since all the standard error codes are really the POSIX error codes.
 
A masochist in the C++ room, how fitting?!
 
@R.MartinhoFernandes wait... that sounds very much like you are saying MS have done something in a standard way...
Interesting a raspberry Pi store...
 
1:19 PM
So what do if I want a function object and a function with the same name?
 
huh... interesting dilemma...
 
I'm getting conflicting declarations if I try it which seems wrong
 
@thecoshman ? What I meant is that you to use the standard error codes for system_error map directly to the POSIX ones, so it is easy to throw it: just pass errno along and it works. On Windows you cannot do that.
 
@R.MartinhoFernandes ah, the end of the stick I got was wrong
 
You need to do something involving GetLastError and possibly a custom error code enum and/or categories and whatever the fuck is needed.
 
1:20 PM
@thecoshman Just what it needs: a closed model for an open system!
 
@thecoshman Sorry I honestly cannot make sense of that :(
 
@Pubby depends how closed it is. an easy to use distribution system could be a good thing
 
Is it s/I/the/?
 
@R.MartinhoFernandes I got the wrong end of the stick
 
1:28 PM
@thecoshman Yoda style
 
@Borgleader perhaps
 
0
Q: Error: Label used but not defined when using && operator

Manavint main() { int i = 0; int *p = &i; int *q = &&i; return 0; } When compiling this using gcc on Linux, I am getting the error addr.c: In function ‘main’: addr.c:6:2: error: label ‘i’ used but not defined Why is the compiler treating int i as label ...

 
That's a pretty dumb question...
 
@Borgleader why do you say so?
 
Well... the && operator is binary, obviously that was going to fail.
 
1:34 PM
 
if he'd meant it to be taking the address of the address of something the title would not be "&& operator"
@TonyTheLion rofl
51 hours from now my semester will be over :D
 
struct loc (

float **mig;

}

loc Loc = new loc[nthread];
for(i=0; i<nthread; i++)
{
    Loc[i].mig = new float*[nx];
    for(j=0; j<nx; j++)
    {
         Loc[i].mig = new float[ny];
    }
}
 
@R.MartinhoFernandes I assume OP is not a 2 star programmer. Well, at least not yet.
(in reply to your last comment)
 
Loc[i].mig = new float*[nx]; that looks wrong?!
 
user142019
1:40 PM
while ((ret = f(std::forward<Args>(args)...) == -1 && errno == EINTR)); I just noticed that parenthesis fail. And I was wondering why my test cases didn't work. -_-'
 
@TonyTheLion Oh noes, not multidimensional arrays, please.
 
int*and temp = std::addressof(i);
int* q = reinterpret_cast<int*>(std::addressof(temp));
 
indeed
 
^proper style
If that even works
 
Woot, nice answer badge.
 
1:42 PM
@R.MartinhoFernandes You just got that one?!?!
 
I don't understand the question.
 
Is it the first time you get that badge?
 
Nice Answer can be awarded more than once. This is my 133rd.
 
Ohhh
 
I wonder why that exists
 
1:45 PM
What is that?
 
niceanswer.png probably
 
actually it's 10701.png
 
@Pubby Psh.. you don't even have the decency to post a svg. Do you even program?
 
@Neil it's a resource from the CDN?
 
@Neil No, I don't program
Mar 19 at 11:38, by Pubby
@sbi Oh, I'm not a professional software engineer. I'm just here for the food.
But I do lift
 
1:47 PM
@sehe It was a joke. You are bad and you should feel bad.
 
@Pubby Wait... there is food? Where?
 
@Neil I'm not bad. In fact, I'm the one always advoquating theuse of SVG
@R.MartinhoFernandes Look closer
 
@R.MartinhoFernandes In my tummy
 
You're a robot, how do you even know what food tastes like.
 
1:52 PM
<):)(🍔)=
 
@Borgleader Meat tastes like awesome.
 
^that's supposed to be me with a hamburger in my tummy
 
What is the hamburger character?
 
1F354 ?
Hot beverage to wash it down: ☕
 
Interesting. Firefox fails to render it as UTF-8, but renders it properly with hex escapes.
 
1:55 PM
I just see a box
Boxes aren't very tasty
 
FAIL
 
How long have they had to get UTF-8 right? Come on guys
 
And oh, if you thought C++Query was bad idea, I hereby present you... jQuery-STL (created by my uni tutor)
 
Strangely, it renders two replacement characters, even though it consists of four UTF-8 code units.
 
And a nice quote from readme "Destructor, if needed, should be called explicitly, but it does not realy destroy instance:"
 
@Pubby Does it mean the rest isn't useful?
 
@BartekBanachewicz Yes
( ͡★ ͜ʖ ͡★)
 
Anyone know if you can use Powershell to automate a program installer?
@thecoshman ಠ_ಠ
 
@TonyTheLion yes...
 
2:02 PM
ok
 
I may be guessing
 
Waiiiit. It's not Firefox's fault. Damn you fileformat.info; you are buggy.
No, Firefox fooled me.
ASrgfdhd.
 
Firefox, more like.... failfox
lol lol lol
 
Y U NO USE CHROME?
 
hahahahahaha, lol
The fileformat.info test page encodes the character as UTF-16 in the UTF-8 test.
Epic fail.
That explains why it used two replacement characters instead of four.
In the UTF-8 cell, there is ��, not a hamburger, right?
 
2:09 PM
@R.MartinhoFernandes I got six of the squares
 
@thecoshman lolwut. What browser?
 
chrome :P
 
Then Chrome sucks :P
 
> You need a font that supports this character to even have a hope of seeing it correctly in the browser.
might explain it :S
 
No, it does not.
 
2:10 PM
the 'should look like' though has an undefined image :S
 
At worst you would get one box, or two replacement characters.
 
Looks delicious
 
Six boxes makes little sense.
@thecoshman Yeah, seems they are not completely up-to-date yet.
 
I got two mario brothers question mark boxes ^^
 
2:12 PM
Yeah, that's I get in FF.
And it's the right thing, because the page is borked.
I cannot trust fileformat.info anymore :(
 
@yetihehe pleasegodohnowhyyyy
bin, please?
 
@R.MartinhoFernandes you have work ¬_¬
 
#define STATEMENT_BEGIN {
#define STATEMENT_END ;}
 
@jalf Happy to help :)
 
Drat, my evil plan to rule the world with army of zombie c++ developers is foiled :/
 
2:19 PM
I have .ps1 file with a function in it, how dafuq do I call this shit in a PowerShell console?
 
> note: inconsistent parameter pack deduction with ‘’ and ‘’
^ Huh?
 
@TonyTheLion bleh, power shell
why confine your self to windows?
 
@thecoshman Wait, what are you trying to say? That he should use... wait, what is the portable shell implementation?
 
@R.MartinhoFernandes one of the very many languages that can be used on (almost) any OS
 
@thecoshman Like PowerShell?
(Yes, you can run that on Mono)
 
2:24 PM
@R.MartinhoFernandes bleh mono
 
Also, why should things like Windows administration scripts be made portable?
 
It will only ever run on a Windows machine
so PS does the job perfectly well
 
meh
 
"bleh", "meh", start making sense, man!
 
shrum
 
2:30 PM
hmmm
so my installer/uninstaller through PS seems to work, however during installation there's a custom console window asking for user input. I need to somehow get that filled in my a machine. Any ideas?
 
Hi
 
Hello friend
 
Just wondering : has anyone here an example case where singletons are a good idea ?
 
Probably not.
 
Uh, when you want to share a cache across several functions maybe?
 
2:36 PM
I have to transform a binary into a library that must be instanciated in several threads, and the original code maintainer decided it was a good idea to have CrappyClass::GetInstance() everywhere, making this trivial task a nightmare.
 
@Pubby You mean a global?
 
@R.MartinhoFernandes It wouldn't be accessible outside of the cpp file
Does singleton imply globally accessible?
 
@Pubby: One can always pass a reference to a cache instance if needed. Why make it global ?
 
@Pubby ... and only one can ever be constructed.
 
Why would you want to pass a cache? That shouldn't be part of the interface.
 
2:39 PM
@ereOn very doubtful
 
@Pubby: Of the public interface, surely. But why couldn't it be part of a private interface ?
 
@Pubby ... yes
 
I don't know. Whenever I've used singletons I've never made them public interface.
(I'm referring to singleton as a function which returns a reference to static)
 
That's just a way of making a lazily initialized global.
 
¬_¬ why do you need a factory method to return a static?
 
user142019
2:40 PM
Is there a standard class that allows me to block the current thread until I set a flag to true (or similar)? I prefer not to use a CPU-eating spin lock. Is that std::condition_variable?
 
@R.MartinhoFernandes What does "global" mean? I thought it meant scope. Do you mean lifetime?
 
And the question before that : why would you need a static for a cache ?
 
@thecoshman Function-local statics are only initialized on demand.
 
@R.MartinhoFernandes ah, I am not to sure what he meant by 'reference to static'
 
@Pubby I use it for anything that can be accessed without going through an argument.
 
2:42 PM
I think this guy will get populist with another upvote: stackoverflow.com/a/13915406/964135 (my answer is better though!)
@R.MartinhoFernandes So class members are "global"? :S
 
@Pubby Nope. Your answer needs to be at least at +11, and his double that.
@Pubby Hidden this argument :P
 
Free variables captured are "global"? :S
 
I dunno, but I don't like the word "global"
 
FWIW, you don't need to capture globals in lambdas, if that is what you mean.
@Pubby Use "porcupine" if you want.
The point is that it is not mentioned in the interface.
 
2:43 PM
I mean capture local variables like a closure
 
@Pubby Those are member variables of the closure.
 
> In computer programming, a global variable is a variable that is accessible in every scope (unless shadowed). Interaction mechanisms with global variables are called global environment (see also global state) mechanisms.
I am confused
 
I can say namespace-scope variable if you prefer.
 
> In software engineering, the singleton pattern is a design pattern that restricts the instantiation of a class to one object.
@R.MartinhoFernandes That's more descriptive I suppose. That includes the "global namespace" though, right? :S
 
2:47 PM
lol
 
So, for clarification, do you consider a single private instance (private singleton) to be bad?
 
not necessarily
it depends on the context
there are many sins which are really interface sins, and if you hide it behind a good interface, it's really not important
 
@TonyTheLion I read that whole thing with Zoidberg's voice
 
@Pubby a singleton is bad because the class is designed such that you can never have to instances of it. Just making a single instance of a class and keeping it internal to a larger class is not bad at all
in summary, single private instance != singleton
 
ok
 
2:50 PM
@Pubby If you add the silly "only one can be constructed" thing, you will have to come up with very convincing reasons for it (hint: you probably will only convince me that your design is deeply flawed from within and that is why constructing two instances leads to the apocalypse). Even without that, global state is usually not a good idea, but sometimes acceptable.
 
I am using a single private instance for OpenGL context stuff hidden behind a non-OpenGL interface, I guess that's okay, right?
 
@Neil hahah
 
global instances, whilst bad, are still better then singleton
 
5 sleds at once, wow
 
@Pubby from the sounds of it, you simple have composition, one class using another class
perfectly normal
 
2:52 PM
 
No I'm not
 
@TonyTheLion Liar.
 
I read it in Morgan Freeman's voice
 
@Pubby OpenGL contexts are thread local. Unless you mean something else.
 
@Neil not really
 
2:52 PM
Hypocrites! The lot of you!
 
Neilocrites -FTFY
 
Well, technically liars.
Hypocritical liars!
 
@R.MartinhoFernandes I don't want one per thread, I just want one context :S
 
@Pubby then only make one
 
Same goes with connection to X
 
2:53 PM
but they are thread local
 
user142019
Why does std::condition_variable::wait take a lock as parameter? What if I want to use it without a lock?
 
@Pubby Don't create two :P You cannot change the fact that if you create one in thread A, using OpenGL functions on thread B won't work.
 
@R.MartinhoFernandes can you not pass the context between threads?
 
@Zoidberg'-- Because the condition variable needs a queue to put waiters on.
 
@R.MartinhoFernandes Yeah, that probably leaks all over my clean interface. I'll probably just keep it singlethreaded.
 
2:56 PM
@Pubby Have a look at this thread here.
 
@thecoshman I don't think so. I think you can create one in each thread and have them share resources or something.
 
@TonyTheLion Thanks. I'll look into wglShareLists (or whatever corresponds to linux)
 
No problem
 
@Pubby xglShareLists probably :P
 
2:59 PM
oh yeah :P
 

« first day (793 days earlier)      last day (4159 days later) »