« first day (357 days earlier)      last day (4597 days later) » 

12:06 AM
@DeadMG It doesn't have any magic anything. Its "hiding" of variables would more accurately be called encapsulation -- it keeps variables internal, and allows manipulation and use via functions -- many of which work at a higher level of abstraction than directly manipulating the variables themselves. IOW, even though it lacks the syntax to express it directly, it's actually using/providing objects.
DirectX largely goes the opposite route: it does have/use OO syntax, but fails to provide real objects.
 
you can only use or provide objects if you actually provide them to the owning program
glInit(); (or whatever it's called) does not provide anything
it just does "magic"
it doesn't give me an object
 
sbi
12:25 AM
> If I were king I’d just start beheading people for writing factories that make factories. It’d collectively save us billions of dollars. And every time you make a singleton, God kills a start-up, two if you think you’ve made it thread-safe. – Landon Dyer
 
12:49 AM
i always have trouble remembering what "spring" is called due to the two terms "fall" and "autumn". I don't understand why there are two terms for the same thing, nor do I understand why that confuses my terminology-circuit when it's asked to find a word for "spring". But anyway, it's late night late in the year, officially autumn or fall, and so I think I will have some strong coffee and vanilla ice cream.
or is it already winter?
hm
 
 
2 hours later…
2:23 AM
it's not officially winter til...i think december 21
 
3:20 AM
Hey guys. I was going to post this to StackOverflow, but I wasn't sure if it warranted a full post seeing as how it compiles. It appears I'm overlooking something minor, but problematic enough to stall the program to death.
pastie.org/2658845 <- See anything wrong with this?
Oh man. When did it get so late?
 
4:19 AM
Hey folks, hope u could help me out with this.. In linux, is there any way to get the directories in $PATH variable as a list or array? I need to use those directories for searching a file...
 
 
1 hour later…
5:29 AM
@AswinParthasarathy in c++? i'm thinking a combination of getenv, istrstream or istringstream, and getline(..., ':')
it'd be better put into a vector of strings, though
 
5:51 AM
getenv + Boost::split
 
6:18 AM
I just got 10 rep. for absolutely no reason at all.
 
there's probably a reason for it. rep doesn't just randomly appear. :) it's likely that one of your old posts got upvoted
happens to me once in a while too
 
hey is there any way to print the numbers in binary digits
binary digits in output screen
 
not seeing a standard way...the io manipulators include hex, dec, and oct, but i'm not seeing a bin (which is what i'd expect it to be called)
you'd probably have to do it manually
 
 
2 hours later…
8:54 AM
hello
 
9:28 AM
what's up
 
 
1 hour later…
10:52 AM
@BasicBridge you can use a std::bitset
@AswinParthasarathy there must already be some API for searching for a file in the directories of PATH
 
is there a way to limit a template function to only work with integer-types (char, short, int, long, long long)? or should i just not care if it breaks for other types?
 
does anyone know is there a kernal sdk for C++??
 
@cHao i general, don'T care about that
if a class behaves like an integer why not let the template work with that class too?
 
because it probably won't, particularly if it's virtual :P
hold on
i'm probably doing something really bad here...but it works for me :P
 
11:13 AM
@cHao yes. e.g. check out boost::enable_if
 
Don't mean to join and ask stupid questions but how do you "accept" an answer on here?
 
check the greyed-out checkbox next to it
well
not on here...cause there's no checkbox :)
but on SO proper
 
OK now I feel like an idiot :P
thanks
 
@cHao IIRC there's nothing wrong with reading the binary representation of any object (aka object representation) no matter which type.
That's not what you're doing though, I'm addressing your comment about 'virtual'. You're doing arithmetic.
Pretty sure your arithmetic is safe and would work for an arithmetic UDT too.
 
i'm doing arithmetic that depends on the size of the thingie passed in (which, particularly if the type has a vtable, will likely be useless for a UDT)
which is part of why i'm wondering if i'm doing this wrong...lol
 
11:26 AM
That would mean that at worst you'd chop off bits, not that bad things happen.
 
11:50 AM
oh hi
 
Ell
hi guys
i need some help :( i know its Ogre specific but nobody is replying on their forums. I think its a deadlock or race conditions or some threading problems
http://pastebin.com/RDQyzz5D <-- Header file
http://pastebin.com/Q68hFwrw <-- Source file
http://pastebin.com/WGLzafiy <-- Stack trace
dont worry, there is only a small amount of code
and the namespace name will make it worthwhiel
can somebody please have a look?
or is this the time to actually open a queston? I just dont want people telling me to ask on the ogre forums
meh, il open a question
 
people won't tell you to ask on the ogre forums if you nave a non-ogre-specific problem, even if it's full of ogre code
and even if you had an ogre-specific question, they still probably wouldn't tell you to go away
 
Ell
okay
its just I really dont get it
if i have this code for example
a()
b()
and it works fine
and then i change it to
a()
b()
c()
then a() stops working
how is this!?
how can code that hasnt been run yet affect code that has been run earlier than it?
 
12:07 PM
Magic.
 
Ell
i know :(
 
@Ell As an old IT teacher I once had many many years ago once said "Kian, have you ever considered gardening instead of computers? It's just with gardening, if they have a greenhouse, and you put up another one, the other green house doesn't just suddenly fall down." I laughed and obliviously carried on with programming
 
Ell
lolsss
thats good :)
 
hey
hey, i wanted to ask, can I run repair on Windows 7 64 bit with Windows 7 32 bit?
 
@Ell Have you checked e.g. in a debugger that on line 153 you're not dereferencing an invalid pointer?
 
Ell
12:16 PM
of which file? :O
ogreroot?
oh dayum
i have to go now
i will be back after i have eaten, sorry
 
hi
say hi back
 
Hi
:L
 
lol @KianMayne hi :P
 
hi back
 
I'm going now - carrying out the duties that we are all obliged to do - IT support for parents :L
 
12:26 PM
@Cat++ hiya!
@KianMayne tell me lol
I didn't know you could do this int a = 5 equiv to int a = {5}
 
That's new with C++11.
 
It works on my compiler and it is old
borland c++ i believe it doesn't compile C++11 code
how do you explain that? :S
 
Borland is probably correct and I'm probably not.
 
ha an explanation for everything, there is
 
The new stuff is int a { 5 };. And T t = { stuff }; will not work for a lot of cases in C++03, whereas it almost always work in C++11.
 
12:35 PM
ah yeah sweet
When you do char *s="Hello World!" we all know s points the first char..does the compiler always check to see if there are other characters beside H I guess it does...it will keep going until it sees the null character
 
afternoon y'all
 
@TonyTheLion hey
 
@LewsTherin There's no need for the check in the first place. What would you want the compiler to check that for?
 
@LewsTherin hello, how goes it?
 
if there is no need for the check how does it know to print "Hello World!" oh wait I know the answer to that
it uses a loop while(*s!=NULL) in printf I assume
@TonyTheLion not much reading up on lvalues and rvalues but the explanation is crap
 
12:40 PM
Never do char *p = "...";.
 
why not
oh
it is immutable?
 
It is.
 
Yes. And you probably shouldn't be touching char pointers anyway.
 
Why not?
I mean the alternative would be const char greetings[15] = "Hello ..."
 
@LewsTherin interesting material though
 
12:44 PM
@LewsTherin std::string.
 
@TonyTheLion yeah but it leaves me scratching my head most of the time...
@LucDanton oops I still think in C
 
yeah, not easiest thing to wrap one's head around
 
Very true for me at least. It takes me more than a week to have a vague understanding.
 
Coding to this is amazing.
I've still yet to determine if using the Doom music in my game is covered under fair use, but I could care less.
 
For example an rvalue its a memory location so int a is an rvalue 5 is also a memory location but not an rvalue in algebra terms it makes sense, but it has a memory location so why not rvalue
 
12:49 PM
@LewsTherin lvalues/rvalues are expressions (either full expressions or subexpressions). It's not meaningful to attach the concept to memory locations.
 
Yeah, the next thing you do after that is look for them in generated assembly.
 
subexpressions what's that
 
An expression that appears inside another expression :)
for instance 2+2 is a valid full expression that can appear in the (pointless) statement 2 + 2;, but it can also appear in a larger expression like foo(2 + 2)
 
oh yeah
this guy uses memory locations to explain it...
 
And 5 is an rvalue.
 
12:54 PM
yeah it is, but an lvalue can also be a rvalue why not for 5..forgetting algebra
 
An lvalue can be used as an rvalue, but that doesn't make it an rvalue. 5 is an rvalue and is not an lvalue.
i.e. wherever an rvalue may appear, so can an lvalue.
 
So what is the how or why?
So in simple terms 5 is not an rvalue because it's a temporary, a constant, no fixed address...
 
6 mins ago, by Luc Danton
And 5 is an rvalue.
 
oops typo
I meant lvalue... can't edit it
 
5 is not an lvalue because it doesn't need to be. Hence might as well specify it as an rvalue.
5 doesn't need an identity for instance.
This makes the life of implementors easier, as they don't have to deal with things like &5.
 
1:03 PM
lol..
but a reference can do that
it can bind to an rvalue
rvalue in this case temporaries
 
Yes. So what?
If you do int&& ref = 5; then the expression ref is an lvalue.
 
Why is that allowed
ah not that thing again &&
 
It solves the forwarding problem, which enables perfect-forwarding. And by that token move semantics.
 
I don't know what that means....but I meant int &ref = 5 ; compiles
 
@LewsTherin Not on a conforming compiler.
 
1:09 PM
i will try msvc now
yeah it didn't work
const int &ref = 5; works
Why'd a compiler allow that..why would I make a reference to a temporary in the first place...what's the point?
 
When you do int const& r = 5; or int&& r = 5;, as an exception the lifetime of the temporary is extended.
 
Would there be a reason to extend the lifetime of a temporary
I can't imagine a scenario...
 
It makes those kinds of reference initialization usable at block scope or namespace scope. That's about it though.
 
this is so sick...
 
@LucDanton an example please?
@JohannesSchaublitb blocked
 
1:18 PM
@JohannesSchaublitb i'm not sure i would enjoy a homosexual teaser video right now.
 
@AlfPSteinbach i don't know what the fuck you are talking about
 
@johannes: i mean, that's so gay
 
@AlfPSteinbach you haven't watched it. you are clearly being stupid now
 
@LewsTherin Simply int const& ref = 5; works as an example. The 'block scope/namespace scope' stuff means that lifetime extension only occurs when declaring reference variables. It doesn't work with void foo(int const& ref); foo(5); where in this case the lifetime of the temporary is not extended.
 
Oh yeah that was what I was wondering...so that is extending the lifetime of a temporary is useless
is it a side effect or something
 
1:22 PM
in foo(someIntTemporary) the lifetime is not extended. the temporary just lives until the end of the full expression
@LewsTherin pw is "isajid"
 
What is pw and "isajid"?
 
@LewsTherin nvm
 
@JohannesSchaublitb Yeah but my question is what is the use then of being able to do int const &ref = 5..it supports it but it doesn't seem to have any application
 
@LewsTherin i was wondering what is blocked
 
@JohannesSchaublitb that's not nice..I'd be wondering what that is forever now
 
1:26 PM
i'm still wondering :)
 
so am i, I am now wondering what is pw and "isajid" tell me and tell you what is blocked :)
 
@LewsTherin since you wanted something from me I shall first hear what is blocked and then I tell you what pw and "isajid" means.
 
How can I trust that you'd
 
no way. you will have to take the risk if you want to know
lol
 
string f() { return "abc"; }does this create a string literal in memory..before creating a string object ?
@JohannesSchaublitb I am trusting you then... I meant the video you posted is blocked where I lived
so what does it mean ? lol
 
1:35 PM
@LewsTherin oh that's sad to hear
 
"abc" will always mean there's an associated array somewhere in the program (before the as-if rule). So nothing happens before creating the std::string.
 
@JohannesSchaublitb must be a great vid :P so what does it mean?
 
@LewsTherin it's the password for vimeo.com/11352212
@LewsTherin just the real life
 
@LewsTherin the string literal is static data and cannot reasonably be said to be created. it's just there, placed by the loader.
 
@JohannesSchaublitb ah I see vid works now..was linked to youtube before
 
1:37 PM
@JohannesSchaublitb that's the same video. about homosexuality in afghanistan. why is it password-protected?
 
@AlfPSteinbach something can't just be there...it must be created
@LucDanton what is an as-if rule
 
@LewsTherin that's a philosophical stance that is irrational
 
@LewsTherin In this context you can assume I meant "disregarding compiler optimizations".
 
@AlfPSteinbach it's not about homosexuality. why don't you just watch it
@AlfPSteinbach i've no idea why it is password protected.
.
 
@lews: if you want the gory philosophical details, it all stems from a misconception of the word "exist", conflating two quite different meanings. then one comes up with silly conclusions about "must be created", so on.
 
1:40 PM
oh I shouldn't have written that..this will just deviate from what I wanna know lol
So return "abc" returns a const char *
 
Well, assuming the function/lambda returns const char*, yes.
 
in your context it returns a std::string( "abc" )
 
that depends on whether you include or exclude implicit conversions in what you call "returns"
 
oh, I was thinking that "abc" is placed in read only area then string object is created and the contents copied into it...so I suppose the compiler writes code to create a string object like @Alf did
 
@LewsTherin exactly
 
1:45 PM
@JohannesSchaublitb cool nice one
I think I need a break..every day I learn programming grr
 
guys, I now have 888 upvotes in c++11 tag! aaaahaha
 
hi everybody
 
hey
 
i have to write a matrix in size a[400][400][400] in my code but i have memory problem can everybody help me? i have 4 gig ram memory
 
www.stackoverflow.com
 
1:57 PM
wow
 
References that are members of objects, can they be bound to a temporary? This guy says it can't, yet it works for me
In the example above, the temporary returned by f() lives until the closing curly brace. (Note this only applies to stack-based references. It doesn’t work for references that are members of objects.)
// Example 1

string f() { return "abc"; }

void g() {
const string& s = f();
  cout << s << endl;    // can we still use the "temporary" object?
}
 
"works"
that's not a member reference?
 
@LewsTherin yes we can
 
but he's right, you can't do this for member references, only stack-based references
 
2:04 PM
for member references used in an aggregate initialization, the spec is quiet
it formally requires lengthening the lifetime but the intent is that lifetime is not extended
 
what is aggregate initialization
 
i sent a DR about it but the DR was ignored
 
    @DeadMG it works


    #include <iostream>
    #include <string>

    using namespace std;

    class A
    {
        public:
            const int &refs ;
            A(const int &a):refs(a)
            {

            }

    };
    int main()
    {
        A a(6) ;
    }
 
which I suspect may support @AlfPSteinbach's often used argument of political intricates
@LewsTherin yes that is UB if you afterwards use a.refs
 
It printed 6
I don't understand why is it it UB
 
2:07 PM
The reference will bind but be left dangling after construction because the temporary will have expired.
@LewsTherin You should consider the lifetime extension of temporaries an exception, not the rule.
 
with compound literals you can say A a((int){6}); to be safe tho
 
@JohannesSchaublitb What's a designated initializer in C++?
 
the created int will have automatic storage duration associated with the nearest enclosing block
@LucDanton C99
 
@LewsTherin The fact that it printed 6 is irrelevant. Undefined behaviour means anything may happen- including working as you expect
 
@LewsTherin it could aswell print 7
 
2:09 PM
Well that's a compound literal, not a designed initializer, isn't it?
 
you can't just whip up some tiny toy program and say that it works
 
@LucDanton fixed
 
I thought it lived until the reference expires, which is when the object is destroyed
 
@LewsTherin no...
 
2:10 PM
as we said previously, and as you quoted
only for stack-based references
 
@LewsTherin (That's a circular argument, but that's not important right now.)
 
only for references that have automatic storage duration
and only for the subset of those that are not data members and not function parameters
 
Right, so function parameters and member objects are exceptions to the rule
 
why would function calls be an exception?
 
Arguably they are the rule as that happens far more often.
 
2:11 PM
if you call a function with a temporary, then the temporary must exist until after the call is done anyway
so there's no need for lifetime extension
 
for example in int const &x = 10; int main() { } lifetime is lengthened too. so we need to include references that have static storage duration, excluding again those that are data members
note that references do have a storage duration, disregarding of the fact that they may or may not have an underlying storage by the implementation
 
@DeadMG yeah cool
 
@JohannesSchaublitb Wording in 12.2/5 suggests that namespace scope is fine too, and hence other storage durations.
 
@LucDanton see my update re static storage durations :)
 
@JohannesSchaublitb ye true lol
ok thanks..at least I learnt something today, vague but it is there
 
2:58 PM
Is C++ considered a relatively verbose language?
 
@Maxpm yes and no. it allows extreme terseness but sometimes require extreme verbosity, like for specifying types. it is a product of evolution, with contradicting forces at play
 
sbi
3:13 PM
@Maxpm Whoever thinks C++ is verbose should try to write Ada.
 
or Lisp or Scheme
 
sbi
@TonyTheLion Ah, those mountains of closing parentheses are nothing compared to Ada's end if/end loop orgies. :)
 
@sbi hahah
so what's everyone up to?
 
sbi
@TonyTheLion I'm going to to leave for a concert pretty soon.
 
@sbi oh that sounds like fun :)
 
3:29 PM
He is going out, how is that fun?
well I suppose it depends whether you like going out..
 
sbi
@LewsTherin I'm going to go with an old and very good friend of mine to a concert of a rather unknown American singer in order to see the rather unknown American singer supporting him on a rather unknown Berlin stage. :) If that's not fun, then what would be?
 
heheh, sounds like fun to me :)
 
@sbi if he is a very good friend I guess. But I'd rather know the singer :)
 
sbi
@LewsTherin She is a very good friend. And I know the singer. In fact, I have her last album (as mp3). Me having her album doesn't make her all that much more known, though.
 
A function copy is similar to this right?


void f(int n){}
main(){   int x = 10 ; f(x)}
when f(n) is invoked what happens is basically like an assignment operator right?
So n =x
@sbi you should have said it is a she yeah definitely fun :P
@sbi who is the singer?
 
sbi
3:38 PM
@LewsTherin Oh, there's two she's involved. Which one are you referring to?
 
What is a function copy? And what is being assigned?
 
@Sbi the one you're going with
@LucDanton when I invoke f(x) it copies the value x into n or the local variable n in the function parameter
I'm just wondering how the copy happens...is it similar to n=x
 
Yes. In this respect it's similar to initialization, not assignment.
It's similar to int n = x; and this form is in fact called copy initialization.
 
sbi
@LewsTherin Often, n is called the formal argument, and x the actually argument. When you call the function, the formal argument is copy-constructed from the actual argument. (That's because you pass by copy.)
 
@LucDanton ok yeah I was wondering that thanks.
@sbi thanks, I keep confusing them. formal argument or parameter yeah? and the value passed in is the argument
 
sbi
3:42 PM
@LewsTherin In this case it doesn't matter that much that this is a female friend. Well, at least not in the way you are likely referring to. We've been over that a decade ago. :)
@LewsTherin ...the actual argument. Yeah.
 
@sbi mmn you're right not that famous...she sounds good though.
 
sbi
@LewsTherin Damn, that site shows a new album. I don't know that one. Sigh. So I guess I'm in for hearing songs unknown to me. :)
 
@sbi I love hearing unknown songs..it keeps me from replaying the songs I love to death
 
sbi
@LewsTherin Yeah, I know that very well. I watched a movie with my teenage daughter on Wednesday, and couldn't get rid of one of the songs from it ever since. I hope that will change tonight. :)
 
@sbi She does sound good, so you most probably will have a good time. But she doesn't sound to me like a concert with much dancing and jumping, I guess that's not what you want?
 
sbi
3:51 PM
@LewsTherin I'm hearing a lot of different kinds of music, but much of it is the slower kind. I like paying attention to the lyrics more than I ever liked jumping around. :) (But I did have times when I listened to Hard Rock, and remember doing pogo dancing on concerts. When I was young.)
 
Is there a difference between Moon(Moon const &moon);and this Moon(const Moon &moon)they translate the same to me
 
sbi
@LewsTherin No difference. Whether the const is left or right of what it constifies doesn't matter. Mostly. Sigh. C's declaration syntax is a mess.
 
@sbi God know, I am not into hard rock or metal rock, but Greenday, Linkin Park and TDG are my favorite hardcore rock band. But there are songs that can get you jumping around without it being metal :)
That's cool, they allowed it because the interpretation is the same lmao
 
function argument passing in fact is equivalent to int x = n
both forms are called copy initialization. not just the former
copy initialization is described using the former syntax because it's easy to denote what is the variable initialized and what the initializer. but from the meanings, both are exactly the same.
 
Yeah it makes perfect sense to initialize it that way and it makes it easier lol
 

« first day (357 days earlier)      last day (4597 days later) »