« first day (523 days earlier)      last day (4425 days later) » 

5:00 PM
@RMartinhoFernandes Where are you reading this?
 
C support includes _Alignas. C++ support doesn't include alignas. Go figure.
@Pubby Release notes.
 
@RMartinhoFernandes C only has PODs!
 
@LucDanton How does that change anything? __attribute__((__aligned(X)))__ already works on non-PODs.
 
Doesn't mean that's Standard-conforming!!!
 
It's just a freaking keyword and support for using types instead of integers and support for combining them all.
Currently, multiple attributes of those picks the last one. I would like to know who came up with those braindead semantics.
 
5:08 PM
> Now that you've admitted that Ninefingers isn't your real name, I have no choice but to ban you. – Bill the Lizard♦ 4 hours ago
 
is it a good idea to use enumerated type for storing my constant variable since they dont take any memory ?
 
@RMartinhoFernandes I could see it making sense if all you had for metaprogramming was the C preprocessor.
 
Wait... I think I may be able to hack my macro thing to work with multiple ones...
I just need to sort them by alignment first!
I have zero need for this, but I'm obsessed with it for some reason.
 
lol
 
Meanwhile, I do have a need for it, but I'm too lazy to refactor my variant.
 
5:10 PM
@AlexDan Constants take as much memory as enum values.
 
wait, did C++11 add non-static data initializers? neat!
 
I find it convenient to write e.g. class foo { public: foo() = default; /* other constructors can go here */ private: bar* p = nullptr; };
(The defaulted declaration is only needed if/when there are e.g. value constructors.)
 
Yeah, foo() = default; is now my default default constructor.
 
At first I was worrying about encapsulation but as it turns out you can do something like
 
@RMartinhoFernandes I read in a book that they dont take any memory if you dont declate a variable from that enum type that've created, so for example : enum color{yellow=19,black=322,white=3,red=21}; so I can use them without storing any memory
 
5:12 PM
@user1131997 Generate lots of code. Compile C++ to C backend (I think LLVM can do it)
 
@AlexDan The numbers will be in the executable somewhere. Computers are not magic.
 
struct foo { foo() = default; private: static const bar default_bar; bar b = default_bar; }; and there you go.
Of course in this case writing a definition for the default constructor is sane, too. I still like that new way.
 
@RMartinhoFernandes I thought they act like Macros substitution, because when I try to get for example &red an address of red, it gives an error
 
@AlexDan The number has to be somewhere.
Anyway, if you have so many constants that they cause a memory consumption problem, I'd say you should be worried.
 
@AlexDan &enumerator is similar (and just as invalid) as &42. Note however that a variable of enumeration type is not the same as an enumerator.
 
5:17 PM
@AlexDan AlexDan: R Martinho means by somewhere that it's in the instruction opcodes if nowhere else, like a macro would be.
 
@MooingDuck : Macro have to be replaced by the preprocessor, sothat the compiler will deal with the number not a variable but in the case of enumeration , the compiler must deal with them as variable so I guess they must have an address where they get stored , no ?
 
@AlexDan an instance of an enumeration will have an address. A value of an enumeration does not, and lives in the instruction ops.
 
I.e. the difference between an enumerator and a variable of enumeration type.
 
Why can't I delete that?
@LucDanton right, you said an enumerator, my mistake. But I can't delete my mistake :(
 
Deleting works on my end.
 
5:24 PM
yeah, it's just that one line that bugged out. There, I can edit it at least.
oh, now I can delete it.
 
@MooingDuck : what is the correct term for instruction ops, so I can look it up, and thanks
 
@AlexDan x86 compiles to "machine code", but your probably more interested in "assembly". What are you trying to look up?
 
you said the the values lives in the instruction ops
so I want to find out more about this
 
@AlexDan yeah, values like that are usually directly in the assembly/machine code
(or for languages that have bytecodes, it's in that)
int a = 5;
int b = 7;
int c = a + b; /*in assembly, it will grab two variables, add them and store in c*/
int d = a + 7; /*in assembly, it will grab one variable, add seven and store in d*/
//The seven is in the instructions, not in a variable.
 
Haha, it seems like the most erroneous answers always get the first upvote
 
5:32 PM
@MooingDuck thanks, I guess I'll read more about x86 assembly
 
huh
I just had the most unsettling experience ever
 
Do tell
 
I was playing Starcraft 2 online and I absolutely annihilated my opponent
 
@AlexDan I'm confused as to what you're trying to do/learn here :/
 
at which point he actually complimented me
 
5:33 PM
@DeadMG Why is that unsettling
 
@SethCarnegie Starcraft2 matches equal opponents, so landslides are rare.
@SethCarnegie compliments online even more so
 
@MooingDuck was confused about how the compiler deal with such type of data, so I guess to understand more I should Learn assembly
 
@AlexDan yes, learn assembly
then learn lisp
 
why lisp
 
It's indisputably the best programming language ever
 
5:38 PM
I wasn't aware that "undisputably" meant "if you ignore Haskell".
 
Haskell sucks
 
@AlexDan You certainly don't need to learn assembly to understand this.
 
@AlexDan I don't know x86 assembly. I know of assembly in general.
 
If the code uses the number 42, but it is not stored anywhere, how could the program work?
Damn, I have a typo up there.
 
it wont
 
5:41 PM
@RMartinhoFernandes What typo?
 
@AlexDan Exactly. It must be somewhere. Usually, it's embedded right into the machine intructions.
 
I've gotta run The Gauntlet™ now
 
It doesn't matter how you use a constant, it has to use memory.
 
Xeo
0
Q: C++ coin flip program PLease help asap

user1286593Coin Toss Write a program that allows the user to play the following game. The user specifies how many times to toss a coin, and guesses the number of times heads or tails will come out. If the user’s guess is right, he “wins”, otherwise he “loses”. The user should be able to continue playing th...

Nukage requested
 
The fact that you can't take its adress doesn't mean it doesn't.
@DeadMG "undisputably"
 
5:43 PM
@RMartinhoFernandes Looks fine to me.
 
@DeadMG Not if I'm quoting "indisputably".
 
indisputably is wrong
 
But it's what I wanted to quote.
 
eh
that's your loss then :P
 
is there a good reason arrays aren't copiable other than to prevent accidental slowdown?
 
5:46 PM
still
 
Xeo
Yay, nukage commenced.
 
I have to leave soon to purchase food
wish me luck for not purchasing £1000 of sugar and fat,and £10 of actual food
 
Xeo
@MooingDuck There is no reason, actually.
 
@MooingDuck The reason is just C.
 
@DeadMG didn't you say that yesterday
@RMartinhoFernandes same question applies to C then
 
5:47 PM
C doesn't need to make sense.
 
Xeo
struct X{ int arr[5]; }; // copy however you like
@RMartinhoFernandes Even that doesn't make sence, since you can always just pack it into a struct.
 
@Xeo std::array. I was just wondering why do we have to do workarounds
 
Xeo
And get your copy semantics.
 
34 secs ago, by R. Martinho Fernandes
C doesn't need to make sense.
 
@MooingDuck I don't think so
oh, I know why you can't copy arrays
 
5:49 PM
lulz\
 
@RMartinhoFernandes now that I think on it, I recall how closely C mirrors hardware capabilities, and processors can't copy arrays as a single operation. ergo...
 
Can I exaclty call function from #define preprocessor? Not define it, but exactly call it?
 
void f(int[] x, int[] y) { x = y; // OOPS- size unknown! }
 
@DeadMG Those are pointers (once you fix the syntax).
 
@DeadMG those are pointers disguised as arrays :/ Which also shouldn't be allowed IMO
 
5:50 PM
@DeadMG Then make int[] not copyable, the rest can work.
 
@user1131997 I can't figure out what your asking us
 
@RMartinhoFernandes Yes, I know that. But it's kinda abstraction-breaking, don't you think?
 
Abstraction? Guys, C.
 
in any case, I think the whole thing was stupid bullshit, but that's hardly news
 
@RMartinhoFernandes C has some abstraction. struct, union, long long (on 32bit)
 
5:51 PM
@MooingDuck there is some function, which already is defined, for example srand(), I want to try call it from #define exaclty, is it possible? or #define is only for definitions? may be there is some trick?
 
No, you can't.
 
@user1131997 define is for text replacement.
 
I have recently helped someone introducing a random seed at compile-time, but it was in C++. Not doable in C.
 
@RMartinhoFernandes oooh, he's trying to make a define be the result of a function? That's... different
 
@MooingDuck I don't know, but that's what it sounds like to me.
 
5:54 PM
You can use __TIME__ as an argument to a pseudorandom constexpr function…
 
Googling myself (for what purpose I shall not disclose) I stumbled over my old homepage from 1999. Evidently they have resurrected it! I didn't know.
 
Mar 8 at 10:12, by R. Martinho Fernandes
constexpr int get_seed(const char* time = __TIME__, int multiplier = 3600) {
    return *time? (((time[0]-'0') * 10 + (time[1]-'0')) * multiplier) + get_seed(time+3, multiplier/60): 0;
}
 
@Potatoswatter that's a good thought
 
Actually, __TIME__ provides enough randomness that a C #define can easily hash it.
 
(Note, this version is broken).
 
5:56 PM
@RMartinhoFernandes Do you just have a bookmark list of snippets that are soon going to be apropos?
 
I'm from the future.
 
Makes sense.
 
#define SEED (__TIME__[0]*36000 + __TIME__[1]*3600 + __TIME__[3]*600 + __TIME__[4]*60 + __TIME__[6]*10 + __TIME__[7])
But you can hardly do much with it.
I guess you could use Boost.PP to recursively apply a some PRNG algorithm on it.
And get something like GET_RANDOM(n) to get the nth in the sequence.
 
@RMartinhoFernandes can't you just run __COUNTER__ through a simple hash for most cases?
 
@MooingDuck That won't vary from build to build, I think.
 
6:02 PM
@RMartinhoFernandes oh right :(
 
LOL, The Pirate Bay is literally trying to build SkyNet. Ars Technica's comment, "The airborne computers will reportedly be more difficult for law enforcement agencies to terminate."
 
@Potatoswatter I find that hard to believe
 
Anyway, TPB now provides only magnet links. You can mirror TPB on a thumb drive.
 
6:05 PM
@MooingDuck Easy to believe they would try. They're gas bags. (That must make them good aviators, right?)
 
@Potatoswatter also: electricity
 
> Alongside such takedown efforts, the content industry's lobbyists will likely pursue a legislative strategy, such as encouraging sympathetic legislators to ban GPS.
hehe.
 
@MooingDuck Electricity is easy, refueling is hard.
 
@Potatoswatter that's... effectively what I was getting at.
 
Solution: magic.
 
6:10 PM
Just let it crash and replace with a new one. Aren't those things supposed to be cheap?
 
Electronics are cheap, model airplanes are not.
I'm guessing they intend the system to run on nachos and pr0n.
 
Drones are cheap these days.
 
@Potatoswatter how about a balloon?
 
@MooingDuck Didn't think about that. I would expect balloons to be helpless against high wind. So not only will the failure rate be high, they'll tend to fail simultaneously.
 
Hmm, ok $300 cheap.
 
6:15 PM
It's possible. If tethering them to the ground doesn't make the system even more pointless, then that's the way to go :)
 
@Potatoswatter to people's chimneys all around the world!
 
0
Q: Can't print values from array via pointer in template function

user1131997I'm getting the next result with code ( which is below ): 2517608 -858993460 5111116 2759624 1 2517464 2503216 -1052237425 0 0 #define length 0xa #include <cstdio> #include <cstdlib> #include <ctime> typedef int* arrayint; //best O(n) //wosrt O(n^2) template <typename T...

 
@user1131997 You're using printf( "%i", value ) where value is templated…
 
-3
Q: Coinflip program i dont even know where to start

SechCOP 1334 Coin Toss How to Submit: Upload your source file (Lastname_Firstname.cpp) to Angel. Coin Toss Write a program that allows the user to play the following game. The user specifies how many times to toss a coin, and guesses the number of times heads or tails will come out. If the user’s gue...

 
even if it should work for your array of int, that's pointless.
 
6:20 PM
AGain?
 
@user1131997 drive by linking is not allowed
 
Ooh, comments have anchors now!
 
have tried to cast with:

printf("%i", (T)data[i]);

and with reinterpret_cast<T>(arg);

but no success at all :(
@MooingDuck don't understand the words "drive by linking" :(
 
@user1131997 "%i" only works for int. So casting to T won't help anything.
 
Hint: reinterpret_cast is not the solution. I'm confident enough to say this, and I don't know what the problem is yet.
 
6:25 PM
@user1131997 both print functions work perfectly
 
@user1131997 you aren't contributing anything, you just dropped a link. If the puppy weren't asleep, he would have chewed it up.
 
@user1131997 you're not allowed to show up and immediately link something and not discuss the question.
@Potatoswatter I'm so close to 10k rep! When I get there, will I have rights to bin posts too, or for that would I need to be a room owner of one or both rooms?
 
@MooingDuck I think only room ownership confers that. Anyway, I can't do it.
 
@Potatoswatter probably. Oh well, I'll be able to act on flags and remove it if someone flags it :D
 
@MooingDuck When you get there, you get the right to be annoyed by flags.
 
6:29 PM
I remember my first flag. It had a weight of like 25 and was a completely disgusting picture. SO just proudly showed me this and declared that 25 others found it offensive. So confusing.
 
lol
It's mostly unreadable what-looks-like-hindi-to-me-but-I-have-no-idea, or kid squabbles.
Oh, and sometimes people flag Feeds.
 
6:43 PM
hmm, when I install our code from our install server, the file I'm working on is slightly different than when I build it locally, and it's different enough that I can't replace it. And I can't debug it. How can I test my changes? :(
I can't figure out why it's different
 
@Potatoswatter You have said, that problem was with %i in printf() and its connection with T-value printing?
 
all of course rhetorical questions.
 
@user1131997 don't use printf
3
 
0
Q: What is a good kids C++ book?

FredSo you remember back when they had those tutorial books that a kid could go through each chapter and learn something? My 9-year old is interested in programming and I am looking for a book that has tutorials that teach C++. I have found many other good C++ books, but they tend to be too advanced...

Wut?
 
@Potatoswatter the problem wasn't, if the was any additionoal pointer in argument of print_data()
 
6:46 PM
Oh hey, I just realized that the vote counts automatically update themselves... cool
 
@CollinHockey i picked up C++ when I was 9. Didn't get so far with it and went back to C for a few years, but a kid can at least start.
 
because, as I wrote, change code like this:

template <typename T> void print_data(T data)
{
for(int i = 0; i < length; i++)
{
printf("%i\r\n", data[i]);
}
}


all works fine, even with printf()
the different was between (T *data) && (T data), if there is a pointer, the bug has occured
 
@user1131997 Your problem is that you're taking a pointer to an array. But the glaring design errors outweigh the immediate cause of the malfunction.
 
I have defined earlier: typedef int* arrayint;

And with (T data); It works well even with pointer to array
 
oh, so you're taking a pointer to pointer to an array and treating it as an array of pointers to arrays. Whatever. You've written a template that only works with one argument type, and used it with a different type.
 
6:54 PM
it has began to work even with (T *data); :)

with:

template <typename T> inline void print_data(T *data)
{
for(int i = 0; i < length; i++)
{
printf("%i\r\n", (*data[i]));
}
}

int main(void)
{
arrayint data = init<arrayint>();

print_data<arrayint>(&data);

return 0;
}

But, I've got on the middle the access violation ))))
I have unnmaed the pointer like: (*data[i])
 
scarred or starred? a 9yo could be very successful in here.
 
@user1131997 wait in your question print_data never dereferenced data.
@user1131997 I already answered your question, what are you doing?
 
@MooingDuck review my quesion better, where have not referenced the data?
template <typename T> void print_data(T *data)
it was in the first block of code, it's referenced, no?
 
@user1131997 printf("%i\r\n", data[i]); this does not dereference data[i], in any of the codes you posted.
@user1131997 *DE*referenced
 
@MooingDuck printf("%i\r\n", (*data[i]));
 
6:58 PM
@user1131997 that is wrong, don't do that
 
with (T *data);
 
hahaha
 
@user1131997 and that's not in your question
 
What's this called? Organic programming?
 
@Potatoswatter "shotgun debugging"?
 
6:59 PM
@MooingDuck I haven't wrote in question about (*data[i]), but the problem was good detalized
 
@user1131997 I just checked again "*data" is not in your question anywhere
 
If at first it doesn't work, try a random mutation.
Sure to succeed on evolutionary timescales.
 
@MooingDuck why? don't really understand
 
@user1131997 because it's wrong.
@user1131997 your print_data functions, though poorly designed, both work just fine as you use them.
 
maybe try:

printf("%i\r\n", (T)(*data[i]));
 
7:01 PM
@user1131997 Listen: I hate you
@user1131997 why would you possibly do that?
 
@MooingDuck I ignored that code-stealing bastard a long time ago
at least, I think he's the code-stealing bastard
those guys with the userXXXXXXX names always get me confused
 
@DeadMG he must be, he obviously has no idea what he's doing
 
@DeadMG where had I steal the code, and present it as mine?
 
I seem to remember looking through some C binary search tree codes...
but I could be confusing you with someone else
 
@DeadMG and where I have told, that's mine? if paste here linux kernel source, you will also tell, that I have stolen it?
 
7:04 PM
well, I seem to recall you giving the impression that it was yours
in any case, you were on my ignore list for a reason, and back you go
 
@DeadMG You may try with search find some words "it's mine code", it will be possibly surpirse for you, that I never lold "it's mine"
 
Woah, I've just been CAPTCHAed by SO.
 
@RMartinhoFernandes wow
that's rare
 
@RMartinhoFernandes it's to prove you aren't a robot
 
And I've spent the last 10 minutes or so doing absolutely nothing.
WTF?
 
7:07 PM
That's exactly what a robot would claim.
 
The thing is, reCAPTCHA is getting hard to solve these days.
I'm not sure it serves its purpose anymore.
 
I generally have to hit "Gimme another" two or three times.
 
@RMartinhoFernandes yeah. We need something else.
xkcdb has you type in the name of an object in a picture, but I don't know how long that will work.
 
cppreference.com asks you the output of some C++ code.
 
7:09 PM
(it clarifies to use the word that a ten-year-old would use)
 
I think that's the silliest one.
 
@RMartinhoFernandes wouldn't bots be better at that?
 
Exactly.
It's streamlined for bots.
 
why did you think, that I'm not understanding, what I'm doing?

the method with unnaming the porinters is standart, even in those Binary tree code, to access some sub-element

struct T
{
int n;
T *next;
} T;

....

some_method(T **list, int i)
{

(*list)->n = i;

etc...
 
If your IP changes, it captchas you. So the longer you wait, the more likely it is to happen.
 
7:10 PM
@DeadMG Oh, I've heard this code-stealing story before. What's it about?
@Potatoswatter Oh, that could be it. My WiFi dropped during that time.
 
@RMartinhoFernandes He asked us to review/test/help him with a bunch of BST code which turned out to be publicly posted by some...one else
 
@user1131997 note the fact they didn't use *list[something], because that would dereference twice. I know very well how binary trees and pointers work.
 
@user1131997 you, on the other hand, don't seem to know the word "dereference"
 
> C++ for a 9 year old is the most bone-headed idea I have heard in a long time. If you want to make sure that your 9 year old will be terrified of programming for ever more, then this is the course to take. – David Heffernan 28 mins ago
 
7:13 PM
@user1131997 did you ever try my answer to your question?
@RMartinhoFernandes there was a three star coder this morning
 
I can define the array , type of struct T, and put each T-element in this array, some with unreferencing the T-array, I can do such:

(*t_array[i])->n = ... ;

no?

About your answer: the main idea was, that you have told "not to use template in print_data()" as I understand
 
@user1131997 that only works if t_array is of type T**. Is t_array of type T**? If not, then no, you can't do that code.
@user1131997 no, not using a template for print_data was a side comment, it was the last sentance. The error in your code is not to pass the pointer to print_data by reference when the function expects a pointer.
@user1131997 In the first one: void print_data(T *data), you're passing it a int**, which is obviously wrong. In the second one: void print_data(T data), you're passing it an int*, which works fine.
All of this would have been obvious to you if you used C++ instead of "C with templates"
 
Sometimes I suspect people upvote long answers without reading them.
 
thanks a lot, I understand it

I'm not undestand the next, why I use (T *data);

and in its body I use (*data[i]) I shall get the right value from array, but of course goy access violation

I was confused , when I have printed some values from array , the right values ( 3-4 ) and then got violation

vioaltion is understood why, but I don't understand why I'm getting the right value in its
 
1. Posts long answer. 2. Get 2-3 upvotes, no comments. 3. Notice glaring factual error caused by transcription. 4. Fix error. 5. No more upvotes. WTF?
 
7:24 PM
no, your long answer in my topic ( as in anothers ) are pretty fanstastic, thanks a lot

I'm have understood, why my function with Template in malloc() will not work, and I'm reviewing your answer right now too
 
could someone have a look at this one ?
0
Q: Dynamically changing icon [QT/c++]

Povedz Hesloi would like to implement dynamically changing performance tray icon in QT. However i cant seem to find any relevant links on google,so do you have any ideas how to do this ? if you dont know what im asking for,ive created a gif file, where you ll get my idea. So any links,codes,examples are appr...

 
@user1131997 (*data[i]) will only give you the right value for the first one, if you really must pass the function a int**, you should do (*data)[i].
 
I'm retagging it, but not reading it. Sorry, I'm tired. No more help today.
 
@PovedzHeslo no, and that's against the rules
 
Time to get prepared for the next goblin invasion.
 
7:26 PM
@RMartinhoFernandes my roommates managed to wipe out our fortress.
 
Apperently DF sieges are much harder than they used to be
 
If they have undead, they're as hard as before with undead.
Undead have always been nasty: chop them up and all you get is more enemies.
 
@RMartinhoFernandes we stopped playing before the undead kicked in. At that point it was only kobold/goblins. You usually didn't get any sieges until year 5 or so.
 
@MooingDuck thanks a lot!
 
7:28 PM
And even then it was only 10-20 kobold/goblins
 
That's because of in-game factors.
Surroundings and fortress wealth influence a lot.
 
@RMartinhoFernandes My playstyle is mostly the same, and now we get 80+ undead in year 2. That's.... quite different
I'm pretty sure my fortress wealth is lower than it was before too.
 
@MooingDuck I'm on year 6 and no undead.
 
@RMartinhoFernandes wow, lucky :(
 
Loads and loads of goblins though.
 
7:29 PM
@RMartinhoFernandes I have yet to make it through year 3 without a massive undead siege (out of very few samples)
@RMartinhoFernandes catapult battery down a long hall of cage traps
 
@MooingDuck I've had sieges almost every year after the first one.
 
solves everything that can't fly right there
 
@MooingDuck I prefer to chop them up by hand.
My soldiers wear adamantine stitches.
 
@RMartinhoFernandes now that's impressive
@RMartinhoFernandes I tend to avoid adamantine, and to the extent possible, soldiers.
 
It was accidental. I didn't notice they were stocking up the hospital with adamantine strands until it was too late. But I don't care, I have >500 (after equipping the soldiers).
 
7:32 PM
@MooingDuck (*data)[i] - it helped, thanks a lot! really thanks very much! but don't understanding the syntax of C :( why should I put iterator-value outside the unreferenced-pointer :(
 
@user1131997 you have a pointer to an array. To get the array, you have to (*data). That gives you the array. Then you want the int in the i index, which is [i] of that array.
@user1131997 if you weren't giving the array a int**, you wouldn't have that problem. It would just be data[i].
@user1131997 "DEreferenced"
 
@MooingDuck both "de" and "un" prefixs are negations ( mean negations ), no?
 
@user1131997 yes, but that doesn't make them interchangable. You can't "dedo" an action that you've done. That's not a word.
 
@MooingDuck ahhh, may be you mean, that unrefenced, that some object is not set a reference to smth, it the dereference means, the process of getting the object on wich pointer references?
 
7:39 PM
@user1131997 "dereferenced" means "grab the thing this pointer points at" "unreferenced" means "you never use this variable for anything whatsoever". The two words are not related.
int my_func(int a) {
   char d; //unreferenced variable
   return a+3;
 }
 
@MooingDuck thanks a lot, here too :)
 
I just got an eMail from STL: nuwen mingw is back!
 
@ScottW I'm a programmer, I can't words.
 
@FredOverflow Sweet. I'm #73, btw.
 
@RMartinhoFernandes What do you mean #73?
 
7:45 PM
@ScottW "undo"?
 
@FredOverflow Sadly, it doesn't pack GCC 4.7 yet (released today).
 
@RMartinhoFernandes He'll probably release an update in a few days.
 
@FredOverflow I was the 73rd to win the prize on STL's site.
 
Prize? What prize?
 
It's a secret.
 
7:46 PM
Did you win his glass eye?
 
...his healthy eye?
 
> Changed GCC's default mode to C++11.
Sweet.
 
@RMartinhoFernandes You know I was wondering why the distribution is named 'nuwen' but that appears to be the least suspicious thing on this page.
 
@LucDanton You don't know who STL is?
 
7:48 PM
I do. To an extent.
 
> Java is a terrible programming language developed by incompetent programmers. It is not an undue exaggeration to say that everything Java does is wrong. There is nothing interesting that can be learned from Java, except how such an awful programming language can become so popular. Java is said to increase programmer productivity, but this is a half-truth. Java increases the productivity of incompetent programmers; it harms the productivity of excellent programmers.
> Since 90% of programmers are incompetent, the overall effect is that Java increases programmer productivity. I submit that this is the exact opposite of a good thing. Do not waste time with Java; let the incompetent programmers revel in their miserable language while you embrace the wonder that is C++.
You can trust this guy ;)
 
Wtf you on about.
 
@LucDanton this
 
1 min ago, by Luc Danton
Wtf you on about.
 
Eww, text becomes red if you hover the mouse on it.
 
7:53 PM
which pattern can I use that allows only one instance of a class to execute an action, and forbid the other objects to execute this same action. E.g. lets say I have a class car, how can I specify to only one object to be allowed to open the car windows, and the other objects not. (I mean, withou flags). I think this is more about patterns than c++ itself, but I'm implementing it with C++.
 
@LucDanton I'm not sure I know what "Wtf you on about" means exactly. Could you elaborate?
 
I have no idea what you're trying to convey to me, or to what end.
 
There's some serious misunderstanding going on.
 
@rogcg a mutex
 
@LucDanton We're in the C++ lounge. This guys disses Java. Ergo, you can trust him. Get it? ;)
 
7:55 PM
Would you trust a guy that would tell you that the sky is in fact blue?
 
@MooingDuck That's not a pattern!
 
@rogcg You only give one object a reference to the object, done. No need for patterns.
@LucDanton You mean he's stating the obvious?
 
@RMartinhoFernandes I'm pretending it is, since it solves his problem
 
@FredOverflow Yeah.
 
@FredOverflow what if I want to create other objects?
I dont get ur point
 
7:56 PM
@rogcg he's saying you have one global "open_window_action" that is owned by at most one car at a time. It keeps track of it's owner, and a car must own it to open windows
 
@FredOverflow It's not obvious! What if you're on Mars?
Oh, my.
 
@MooingDuck so Ill have to use something like a flag
 
@rogcg yes
 
@MooingDuck I dont want to use flags.
 
@rogcg I don't want to go to work in the mornings
 
7:58 PM
You don't want to solve your problem? I have to say that's an innovative approach to problem-solving.
 
@rogcg Look, if you only want object x to call methods on y, then you pass a (pointer to y) to x, and not to other objects. Then only x will be able to call methods on y.
 
but the problems is not like that, its an exercise
 
@rogcg it can be done without flags, but it's very very complicated, and depends on what tasks are being done in what order and how they all interrelate
 
Do you want to restrict the access to any one object at a time (use a mutex), or to one specific object all the time (then use my approach)?
 
@rogcg without knowing any more about your problem, the best we can do is tell you to use a flag of some sort.
 
7:59 PM
@FredOverflow I think the pointer would help
 

« first day (523 days earlier)      last day (4425 days later) »