« first day (608 days earlier)      last day (4323 days later) » 

12:00 AM
Ok.
Lame Pun Friday is now opun!
 
Tek
You guys... I come from other chatrooms but I check out what you guys are up to from time to time and I have to say:

You are the most off-topic chatroom ever.
 
Tek
@RMartinhoFernandes I know you know, but why is the question.
 
@ScottW why did you post that picture? What's wrong with it?
@Tek orangish-yellow is the answer
 
Tek
@ScottW Same here. Only when you look at the outline that you can tell.
 
12:03 AM
@Tek "Science isn't about why, it's about why not. You ask: why is so much of our science dangerous? I say: why not marry safe science if you love it so much. In fact, why not invent a special safety door that won't hit you in the butt on the way out, because you are fired."
 
Tek
@RMartinhoFernandes Fine, why not stick to the original purpose of this chatroom?
 
What's the purpose of a lounge?
 
@Tek which is to lounge in the presense of those who like C++?
 
Tek
@RMartinhoFernandes There is no purpose. The purpose is only applied when there's a description to that noun. The noun being lounge, lounge being merely a place.
 
> A public room, as in a hotel, theater, or club, in which to sit and relax.
 
12:09 AM
Hello!
 
More or less fine. Wanna discuss c++ grammar?
 
@Tek Anyway, if you wish to discuss C++, by all means discuss it. I doubt anyone will be actively against it. We do discuss it from time to time.
@KirillVKobelev What about it?
 
Tek
@RMartinhoFernandes I was just jesting, yet curious. Not like there's lounge police or anything...
 
Tek
12:13 AM
;p
 
One of the forms of tempate parameter is template.
Standard is saying that argument for such a parameter should have form of "id-expression".
But this non terminal is pretty wide, not just a name. I am curious, can it be anything else than an identifier (maybe qualified). Can any body comment?
 
Yes.
Oh wait, you already considered it can be qualified.
Maybe something like foo<T>::template bar
Nah, that's still a qualified-id.
You're right, it can only be a qualified-id or unqualified-id.
But that doesn't need to be an identifier.
 
wait a second..
 
It can be an operator-function-id, for example.
 
Right, but this from my point of view is not good for template argument.
 
12:23 AM
No. But the grammar doesn't cover the semantic aspects.
The grammar would be even more complex than it already is if they tried to enforce that at that level.
 
I don't understand what you two are saying. Is there something the standard says is allowed as a template parameter that would make no sense?
 
@MooingDuck The grammar allows several things that make no sense.
 
They mention in English text "id-expression" without going any further, while this seems logical to comment.
There are numerous places in the grammar that is presented in a standard where it is possible to make neat and compact.
I developed my own version that I consider to be better.
 
"C++" and "neat and compact" in the same sentence must be a joke.
 
You may take it as a joke. I am not offended.
 
12:30 AM
I'm never offended, nor do I care if I offend anyone.
 
@KirillVKobelev You mean the specification of the grammar? Or make a different grammar?
 
@MooingDuck, Martino is right. Grammar is not an exact definition of the language. And it should not be so.
Nevertheless the grammar can be reorganized and different variants will have different number of rules, different number of conflicts.
Ease of figuring out from these grammar can differ dramatically.
 
Ah, so you're talking about making it easier to specify the grammar itself.
 
... here i do not understand what you mean.
What is "specification of the grammar"?
 
Do you change the language in any way?
 
12:35 AM
Yes.
 
Ah.
Well, it's a well-known fact that the syntax of C++ can be improved.
 
Consider the example above. Will this be a change in the language?
 
@Quuxplusone Hmm, I see you have 51 rep. Maybe you need to wait a couple minutes until the caches get updated or something.
Anyway, welcome :)
 
I am speaking only about this type of changes. Maybe allowing conversion-function-id on the namespace level. I do not fully understand why this is disallowed..
 
What would that be used to?
 
12:40 AM
I use this grammar in my own parser.
oh you mean conversion-function-id?
 
Must. Go. To. Sleep.
 
1:01 AM
Arghh, why does every module tracker suck
 
1:33 AM
I just wrote using namespace ... on a header. Thrice.
 
@RMartinhoFernandes In global scope?
 
Nah.
I'm not evil.
 
namespace evil { using good::r_martinho_fernandes;}
Now you are :)
 
Trailing semicolon!
 
Got around to some prototyping with OGL on our little RTS, need to drive myself to sleep somehow. Accounted for all the necessary extensions 'n' shit.
 
1:40 AM
@DomagojPandža What extensions? (also isn't the wrong room?)
 
Standard extensions, pullin' in the 3.1 profile etc. Nah, just a small sidenote here. Need to hit the bunk, early day tomorrow.
 
Fuck, 4am.
I hate myself.
 
oh the bot is here and awake!
 
What's up?
 
1:51 AM
is this function inherently wrong?
auto operator()(const T& v) const -> decltype(lhs::operator()(v)*rhs::operator()(v)) //LINE 25
{return lhs::operator()(v)*rhs::operator()(v);}
 
The comment seems unnecessary.
 
Why would it?
 
Because I mess up C++11 features, so I'm making sure it wasn't something stimple/stupid/obvious before I hit the "post new question" button
 
lol
Well, I don't see anything wrong with it.
 
@RMartinhoFernandes k
and I still have 5 minutes until windows restarts itself >.>
 
1:55 AM
Can't you delay that?
 
nope
the "restart later" button is greyed out
must be important
 
Well, see you after the break then.
 
2:44 AM
hello guys !
i have a program that runs in my pc. Due to the program goes it 2,700 KB of RAM and after falls to 1200 and goes up to the start again, is it possible that the deque container that i use is crushed ? Does the deque has a limit?
 
3:01 AM
@MooingDuck Can you try with decltype(std::declval<lhs>()(v) * std::declval<rhs>()(v))?
Just to make sure it's not the base subobject lookup thingy.
 
3:22 AM
C++ is pissing me off :)
 
@DiscreteGenius it is not the easiest language to master
 
I feel stupid when I try to go back and utilize what I've learned.
When I try to think about "HOW" to solve the problem, it boggles my mind.
 
> Every submitted app also gets an Ubuntu T-Shirt!
 
so what's the problem you're trying to solve?
 
I might wanna make some shovelware so I can win a t-shirt
 
3:27 AM
Just some of the assignments out of my book (C++ Primer 4th).
 
you might think about how to solve them in Basic. then translate that to C++?
 
I struggle with the logic (like "HOW" to go about it).
 
can you give an example?
i don't have any books
 
@CheersandhthAlf Yeah, I suppose thats a possibility.
Let's see...
 
@Pubby "I wrote a hello-world, and all I got was this lousy T-shirt"
 
3:29 AM
Hey, can anyone answer this question in 30 seconds? stackoverflow.com/a/11042894/1424877
The question is, "why should I unlock a mutex after signaling the condition variable, instead of before?"
 
Read a set of integers into a vector. Calculate and print the sum of each pair of adjacent elements in the vector. If there is an odd number, tell the user and print the value of the last statement without summing it. Now change your program so that it prints the sum of the first and last elements, followed by the sum of the second and second-to-last and so on. Then, redo the exercise, using iterators rather than subscripts to access the elements in the vector.
 
I say "in 30 seconds" because I'm not going to stick around here in chat very long right now, but I'll be watching that question anyway
 
2
A: signal and unlock order

bdonlanFirst, there is no correctness issue here. Either order will work. Recall that whenever you use condition variables, you must loop on a predicate while waiting: pthread_mutex_lock(mutex); while (!predicate) pthread_cond_wait(cvar); pthread_mutex_unlock(mutex); By signalling after the unlock,...

 
@RMartinhoFernandes If I say I'm a young kid and this is My First Ubuntu App they can't deny me a t-shirt.
 
"Read a set of integers into a vector."
 
3:32 AM
I'm thinking I should make a "flashlight" app where it just shows a white screen
 
@DiscreteGenius so what part are you having trouble with first?
 
I think, for the kind of book you're reading they don't think about fancy GUI here.
 
@CheersandhthAlf ...I've written the code for that problem, but then when I go back to use iterators that's where I run into problems.
 
it's more like an algorithm (std::copy) applied to, hm, iterators
 
Ah, thanks, R. Martinho
 
3:33 AM
you need input iterator to copy from
and a pushback'ing iterator to copy to
 
I haven't learned std::copy.
 
finding the name of the latter might be a challenge, but there' s cppreference.com
 
@RMartinhoFernandes how come I didn't get that message until now?
 
@DiscreteGenius learning copy shouldn't take more than 15 seconds?
 
std::copy is pretty advanced stuff
@RMartinhoFernandes should create a graphic novel explaining how it works
 
3:34 AM
lol
 
@RMartinhoFernandes same problem
 
ideone.com/m9LFb This is what I have thus far. I haven't redone it to make use of iterators, yet.
 
3:49 AM
lemme look
looks good
some advice in order
(1) as a general rule, dispose of errors, resource depletion etc. up front in the code. i.e. have that on the "then" branch, not on the "else" branch.
(2) don't use complicated types for a loop index. use "int":
that's what bjarne does
(3) but do make sure that you convert every size() result to int in some way
or to ptrdiff_t if you want to support really large data sets
 
Just use std::size_t.
 
just use int'
don't use size_t, which is unsigned
it's very dumb to do that
 
size_t is cooler
 
...
 
since it has no advantages and some very severe disadvantages (technically)
 
3:53 AM
It has the advantage that you have no signed/unsigned comparisons.
 
no, that's not an advantage when it's because all comparisions are unsigned. you don't get warned about promotions in arithmetic. they then bite you
it's called, throwing the baby out with the bath water
 
@CheersandhthAlf That's the #1 source of 64-bit portability bugs I run into...
 
@CheersandhthAlf My compiler warns when I compare signed and unsigned types.
 
don't compare them
 
3:54 AM
"Oooh I'll index everything with int! Scale up a bit, and BOOM, integer overflow on a 64GB machine."
 
that's dumb
it warns for very good reason
heed the warning
 
The reason being the types don't match...
 
int is not webscale
 
i.e. don't let those unsigned numbers loose in your code
 
@Mysticial "Scale up a bit" - Literally.
 
3:56 AM
@Mysticial for "everything" you should rather use ptrdiff_t type. don't be dumb. apply common sense to everything
 
Use GMP to be safe
 
@CheersandhthAlf Please, 'common sense' is a cop-out term used in place of "because I really want that to be the case".
 
Arrgh, Python Y U UTF-16 BOM my output.
 
I built my 64GB machine in 2009 - back when most desktops had less than 4GB. Virtually every single piece of code broke with a large enough input size.
 
Did you forget what the 'common' stands for? It means we all already agree.
 
4:00 AM
@GManNickG no. it's just stupid to use int for everything. plain stupid. it is lack of common sense. arguing that common sense is a cop-out term is a cop-out.
 
How clever.
 
it's like, always using a cotton wool t-shirt, even as the only clothes in antarctica.
 
Oh and I also broke Visual Studio on that machine too... Found a bunch of bugs in their 64-bit compiler that didn't get fixed until VS2010.
 
just because someone told you it was a good idea in some hotter place.
then complaining about freezing
and saying that someone who advices you to use common sense, is, like, well that must surely be a cop-out term
that's dumb
fairly idiotic
 
The Department of Bad Analogies would like that back.
I know! If I call something dumb and idiotic enough times, everyone will see I'm right!
 
4:02 AM
@GManNickG Alf doesn't know how to debate, leave him be
 
i'm not debating because there have been no arguments. just assertions. then i give characteristics back of course
plus explanations of how dumb the advocated choices are
it's not a good idea to use mechanical rules for programming
it's bound to backfire
 
@CheersandhthAlf Is that a mechanical rule?
 
to never heed advice, that's what i call good advice
 
To whoever asked about it before (@Radek?): I have broke down wheels into several headers that have no dependencies on the others, so you don't have to bring the entire thing just to use a piece: bitbucket.org/martinhofernandes/wheels/downloads/…
 
what is wheels?
 
4:13 AM
My library of stuff.
 
> What should I do to prevent the img object delete automatically by garbage collector?
 
user457812
There's a thing that loads cat pictures in there
 
Why do people think C++ has a GC?
 
user457812
4:14 AM
@Pubby Stupidity.
 
value_ptr, is that a cloning thing?
 
@Pubby Where's that?
 
whoops
1
Q: Using pointers or not using them for class references. What's the difference?

DaneI have functions that return an object, but I'm confused that should I return the object itself or a pointer to the object? Here is an example of my function: CImage CDocument::AddImage(string Name, string fileName) { CImage img = CImage(); img.Name = Name; img.Path = fileName; ...

Dunno why it linked the comment
 
4:22 AM
Human beings. Can't live with 'em, can't commit wholesale genocide.
 
y cannot commit genocide?
it's been done
so, it's doable?
 
Not "wholesale".
 
posted on June 15, 2012 by Scott Meyers

Today I got email from my publisher regarding the bundled electronic versions of my books: Only informIT.com offers this collection in both PDF and ePub formats, together for one price. PRE-ORDER TODAY and SAVE 35% off the list price. Enter the coupon code MEYERS8627 during checkout to receive your discount. Offer expires June 21, 2012. The list price of the bundle is $95.99, but, from

 
I had to laugh at this:if (value == 0)
return value;
else
return 0;
3
 
4:33 AM
hm, missing braces. note that it depends on the type of value whether it is zero in all respects when it compares equal to zero. e.g., you can compare cout to zero, I think.
 
@CheersandhthAlf If that's the case, then instead of just silly, it's evil.
 
yes :-)
sorry, i think you could compare cout to zero in C++03, but no longer in C++11
 
Well, it's "old code" according to the person who posted it, and it doesn't sound like it would be anything other than something like an int.
 
@CheersandhthAlf Ah, yeah, it's a breaking change. They removed operator void*. It only breaks not-so-good code, though.
 
4:36 AM
If you haven't read it, I found some of these pretty funny: rinkworks.com/stupid/cs_programming.shtml
 
> One day I was in a public park, reading "C++ For Dummies" (...)
This is already funny at this point.
 
"What do you mean, I can't initialize things in an assert()?"
 
My teacher has to move out of his room next year, so he's giving out books.
I found some copies of C++ primer
We used the Deitel one in class when I took it, though. Not sure where he got those, but I did find a nice one on flash game programming. Flash + game concepts. Two birds with one stone there.
 
Flash is yucky
 
I've been meaning to learn it, though.
 
4:42 AM
/* This function is BOOL but actually returns TRUE,
   FALSE and -2 because I've no time to change it
   to int */
 
@chris Isn't it dying though?
 
Maybe, it's a good platform for learning to make games, though, which are some concepts I need to get worked into my brain
 
I was just teaching an optional class on C programming; in the first class meeting, I asked, "Does anybody know anything about programming?"

To which one of my students gleefully replied, "I know how to use a chat program!"
 
switch (k) {
case 9: printf("9\n");
case 8: if (k==8) printf("8\n");
case 7: if (k==7) printf("7\n");
// and so on...
}
 
it's funny until you meet such code IRL
 
4:48 AM
That's one thing I love about SO. You can always be sure that if you're doing something bad, you'll know about it.
You really get those good habits drilled in here.
"I wrote it and renamed it to EXE so it could run." - I haven't seen anyone try that, but I think it's cute.
 
Well Windows was written in QBasic - it would work with QBasic sources
 
strcat(string,"\0"); is a masterwork.
 
lol
 
@chris You can do that with a text file in Windows. Let the first two characters be MZ. It's a long time since last I did that, though.
 
#include <ionstream.h>
When I make a game, I'll have a <ionstream.h++>.
 
4:56 AM
[d:\dev]
> echo MZbah >poi.txt

[d:\dev]
> poi.txt
This version of d:\dev\poi.txt is not compatible with the version of Windows you're running. Check your computer's syste
m information to see whether you need a x86 (32-bit) or x64 (64-bit) version of the program, and then contact the softwa
re publisher.

[d:\dev]
> _
 
I've included <isotream> a couple times
 
What does "poi" mean, btw?
 
point of interest
 
point of inflection!
 
4:57 AM
Pile of Intelligence.
 
it's just the three characters to the right on the keyboard
 
what is "bah" in "MZbah"?
 
@Abyx i say to windows, "u r dumb OS"
but convenient
 
why dumb? it's just a file with invalid header
 
5:09 AM
@Abyx files in windows and *nix have have no mandated header part. a unix file is just a stream of bytes. a windows file is just a collection of streams of bytes. that's all.
 
@CheersandhthAlf do you mean "files in FAT32/NTFS/some-nix-fs"?
 
@RMartinhoFernandes Morning!
 
a lot of OS use same FS, like FAT16/FAT32 for flash memory, or CDFS for CD
 
well windows can use a lot of file systems, including fat32. different file systems place different restrictions on the available functionality. e.g. fat32 doesn't support multiple streams and doesn't support hardlinks, as far as I recall. but the api supports these things anyway, and just errs out if the fs doesn't.
 
and then OS uses contents of file (or name of file) to determine what to do with that file
 
5:15 AM
I find it funny how my school prioritizes blocking cmd over blocking the ability to spread viruses anonymously with ease. They "blocked" command.com in about 2 weeks of knowing, but haven't done anything about the latter (when there are obvious solutions) in 6 months.
 
when you write "> poi.txt" you call CreateProcess
 
@Abyx not necessarily. in *nix mostly contents determine file type. in windows, mostly filename extension determines type.
old executable formats are special cases, in support of DOS
so it's the command interpreter doing it, not the general API (i.e. you don't get that effect from Windows Explorer)
 
@CheersandhthAlf Windows uses filename extension to execute "start poi.txt", not just "poi.txt"
 
@chris Powershell?
 
5:17 AM
the command interpreter checks the file contents first, and recognizes "MZ" as magic value for a MicroZoft executable
if you double-click the file in Explorer, the instead it opens in an editor, I think
 
or, precisely ShellExecute(<default action>, fileName)
 
@RMartinhoFernandes, Easier for cmd. You can either use a shortcut, or wrap it in a system() C++ file that lets you do most things you can with cmd.
 
Including going up lines and not having to click end program if you close it
The virus one actually has some nice side effects though
 
5:19 AM
so, there are two different things, CreateProcess and ShellExecute. In Explorer, double click uses ShellExecute and default action for file extension, cmd uses CreateProcess
 
It's what allows us to have our own logon scripts. It basically overrides theirs due to a flaw in theirs.
No harm in that. It saves a lot of time seeing as how everything resets when the computer shuts down and my many utilities stop running when I log off
The problem is when you combine that with the next person to log on (yeah, we have access to the run key, gf) and copy it to start when they log in too
 
i.e. in Explorer, on double-click, Explorer looks for '.txt' in regisrty, and finds that default action is "open" which runs "notepad %1"
 
@Abyx Not quite. In the end ShellExecute calls down to CreateProcess, and the command interpreter's start command uses ShellExecute. But, ShellExecute can elevate, and you can't do that easily (or possibly not at all) by direct use of CreateProcess. I think they bungled it with that change. In Vista.
 
... cmd just either executes embedded command (like start) or calls CreateProcess is there is no such command
 
@Abyx no, not quite. the command interpreter does that simple lookup when you use the filename as a command. it was supported by the assoc and ftype commands. Windows Explorer uses a bit more sophisticated scheme, which just devolves to the old assoc/ftype scheme when there is no additional info.
as part of their strategy to make people stop doing command line things with Windows, in Windows XP service pack 2 or something they lobotomized the ftype command so that it no longer could be used to remove file extension - command associations. only create, no delete.
 
5:25 AM
ah... I'm too lazy to download RegMon and check cmd behavior
 
@Abyx no that's wrong
@Abyx and no, you don't need such tool to check, and i don't think it's appropriate (judging merely from its name)
are you trolling?
 
@CheersandhthAlf what do you mean by "appropriate"? like "RCE is bad thing"?
who cares
 
i mean, wtf would you use it for?
it's like saying you're too lazy to download Excel to create a text file. first of all you don't need such big tool, and secondly Excel is not appropriate
 
@CheersandhthAlf to look if cmd will access to registry when you execute "xxx.yyy"
 
just create a text file and try it
or some other kind of file
where windows "kind" = filename extension
 
5:29 AM
@CheersandhthAlf Just out of curiosity, where are you working and what are you working with?
 
uhm... well, it runs notepad
 
@ManofOneWay i'm not. i'm just helping out with arranging a festival. at the moment.
:)
@Abyx yes. you can use regedit to change the registry. then check again.
 
@CheersandhthAlf Oh I see, but it shouldn't be any problem for you to get a good job I guess?
 
i think so
at least as long as i'm in norway
 
5:32 AM
Jobs are overrated.
 
that's because i've been out of employment for so long
 
@RMartinhoFernandes Jobs is overrated.
 
and secondly, with diabetes and infections and stuff i can't work full time
not yet anyway
 
@RMartinhoFernandes Aren't you working either?
 
@ManofOneWay of course it's working, it even chat here
 
5:33 AM
;)
 
lol
@ManofOneWay I'm sick.
 
@RMartinhoFernandes Then you should be in bed and rest by this hour :)
 
@RMartinhoFernandes of laziness?
 
I am in bed.
@Abyx No, I'm genuinously sick.
Ate something bad, I guess.
 
@CheersandhthAlf I hope it works out. If your willing to move to Sweden I can maybe find you some job here.
 
5:36 AM
i may have to in the end
but it seems i will get a new round in the medical system here in august
maybe they'll be able to fix me :-)
 
@CheersandhthAlf I know that Jalf's company wanted some people, maybe you should apply there
 
Hmm, that reminds me. You guys are more experienced with this. How much of an effect does a reference letter from the CEO of a company related to this subject area help with university/job applications?
 
@RMartinhoFernandes You think Portugal will go on to the next round? It will be a hard game against the Netherlands
 

« first day (608 days earlier)      last day (4323 days later) »