« first day (107 days earlier)      last day (4842 days later) » 

2:00 PM
lolwtf that's dumb
 
I was checking out the chats here yesterday, it's pretty empty everywhere
 
this room usually has stuff going on
 
This is the liveliest I've seen it :P
 
heh
frequent it more often :P
 
What do you usually chat about?
 
2:03 PM
sometimes C++
but usually whatever is on our minds that isn't C++
 
for example
revision
 
revision?
 
I have an exam on Wednesday and three more over the next week for which I am totally unprepared, and I'm sitting here dreaming all day :P
 
What's the exam about?
 
2:07 PM
operating systems and networks
ahem
operating systems and networks of the early 90s
we covered things like segmentation
 
It's two separate courses over here, so you got that going for you :P
 
lol
 
@DeadMG is that memory segmentation? o
 
it's pretty simple stuff for me
why yes, it is
 
oh gosh
have fun :p
 
2:08 PM
pretty sure that memory segmentation hasn't been in a desktop processor for
what, fifteen years?
 
what irks me are the magic facts
like, the network laers
Application Layer, Transport Layer, Network Layer, Data Layer, Physical Layer or someshit like that
 
Application, tcp/udp, mac, etc?
yeah, I could never remember them
 
networking is fun, that's what I always thought
 
more importantly, I don't see the point of asking us to remember the layers
pretty sure that it would go something like
 
2:11 PM
cause they are the basis of a lot of other networking stuff, if you don't know them, things become painful later on
 
HTML, HTTP, TCP/UDP
POP/IMAP go in there... somewhere
 
TCP/UDP is transport layer
HTML is application layer I think
 
sure, but there's a difference between "There are five layers and you should know which one we're working on", and, "There are five layers, go memorize their names"
network layer probably goes above transport layer then
cause it would definitely go HTML, then HTTP, then TCP/UDP
 
yea, memorizing five names can't possibly that hard for someone who knows C++ as well as you do
 
surprisingly, it is
my brain just does not work that way
C++ makes sense; the five names don't
 
2:13 PM
Network Layer = layer 3; Transport Layer = 4
probably somewhere in that networking stuff you don't understand something, right?
 
so where does HTTP go?
because it must go between HTML and TCP/UDP
so if HTML is on the fifth layer and TCP/UDP goes on the fourth layer, then where the hell is HTTP?
 
Application Layer
 
on the same layer as HTML?
 
oh it depends what model you looking at
 
IP, I'm pretty sure
 
2:15 PM
you talking about TCP/IP stack or OSI model?
lol
 
IP stack, for sure
 
the iso or was it osi stack is very nice for teaching at university
mcuh to memorize
 
HTML is not a protocol
 
easy exam questions
i think he meant http
 
it is a language for formatting data
HTTP sits at application layer
 
2:16 PM
@Alf: That's the definition of terrible for teaching at university
I'd rather learn concurrency by miles
 
@DeadMG I live concurrency right now, my project is full of it :)
 
actually, I'd rather do concurrency than a lot of topics we cover
 
oh I love networking, it's interesting
 
i just composed a very nice "idiots boogie" (on three-string guitar)
but it's so much hassle to record on mobile phone
 
ugh
 
2:17 PM
@AlfPSteinbach sounds like fun
 
formal specification = Zzzzzzz
 
anyone knows good program (best free) for converting from sony phone format, something?
 
nope I don't @AlfPSteinbach
 
@Tony yes, i'm terrorizing the neighbours! :-)
 
Nope
 
2:19 PM
I need tips on surviving boring, abstract things full of arcane symbols with no relevance to real code
 
i done it once b4 but i don't remember what i used
 
@DeadMG what arcane symbols are you studying?
 
it's formal specification
 
of what?
 
so the really, really tiny subset of programs that you can prove have no bugs
 
2:21 PM
that must be a really tiny subset
 
oh yeah
 
does this subset have a name?
 
verifiable? I don't really know
didn't pay much attention
 
hmmm
well, I guess if it doesn't interest you in the first place, it's gonna be hard for you to even try to learn it
 
indeed
 
2:23 PM
else I'd say look for some ways this stuff could be useful in real life
 
well
 
maybe it will be less boring then
 
things like nuclear reactor programs
 
Formal specifications is probably the worst course I ever took
 
this semester I had
AI methods, which so far has been things like search algorithms in PROLOG
team projects, which was shitty web development
requirements analysis, which was reasonably interesting
formal specification, which was a total snoozefest, couldn't stay awake
2D graphics, which I haven't looked at all that closly
oh, and OS/networks
 
2:26 PM
well AI sounds interesting... unless you don't like math
but PROLOG sounds a bit out of date
 
it's not that I don't like math
but more that I hate PROLOG
 
lol
 
programs that I could write trivially in C++ like topological sort, take me forever in PROLOG
 
try write AI in C++ then
 
I would do, but, must use PROLOG
 
2:26 PM
tell your professor AI in PROLOG is for a 70 year old
 
I actually like PROLOG
It might take you more time, but it's shorter and more elegant
and not brute force
 
sure, but that has absolutely no value to me whatsoever
I would rather have that time back to go and design a more efficient algorithm
 
It's a different paradigm
 
or spend asleep or something
 
that's always an interesting experience
Tried ML?
 
2:28 PM
@DeadMG you're funny, what's your ambitions after school?
 
I mean, what even is elegance? All the problems and programs my lecturer demonstrated were way worse than their C++ equivalents for any elegance
 
C++ may be many things, but elegant is not one of them :)
 
C++ is extremely elegant, and a hell of a lot more than PROLOG
hell, even C is better than that
 
@Amir I cannot really agree with that, there is very elegant code written in C++
 
I mean, the syntax for PROLOG just to begin with is terrible
no variable types, and so much is implicit
when I read PROLOG, the variables and their names don't make much sense
 
2:30 PM
@DeadMG try objective-C :P
 
when you read C++, every variable has a well defined type and exists in a well-defined place
 
You don't like dynamically typed languages, eh?
 
I'm not a fan of dynamic typing
 
Well, that's another issue altogether
 
but there's dynamic typing, and variables created for you defined by using them
that's terrible
I've used Lua quite extensively, it's dynamically typed and nowhere near as bad as PROLOG
 
2:31 PM
Prolog is a general purpose logic programming language associated with artificial intelligence and computational linguistics. Prolog has its roots in formal logic, and unlike many other programming languages, Prolog is declarative: The program logic is expressed in terms of relations, represented as facts and rules. A computation is initiated by running a query over these relations. The language was first conceived by a group around Alain Colmerauer in Marseille, France, in the early 1970s and the first Prolog system was developed in 1972 by Colmerauer with Philippe Roussel. Prolog w...
sounds yuckkie
 
it really is
 
Errr :P
 
developed in France, says a lot :p
 
formal logic is bad enough to even look at, let alone program in
 
you probably enjoy low level programming, huh?
 
2:33 PM
hey, I love my templates and my objects and my concepts
what I hate is systems for specifying things where it would be a dozen times faster just to write the result
 
recording worked but Explorer crahsed when I plugged in the phone. sending error report to Bill...
 
formal logic is slow, and more importantly, I don't actually see any advantages of it whatsoever
 
It's strong in the AI field
 
why bother? formal language has no advantage over the same idea written in C++
 
It has clarity and elegance.
 
2:35 PM
except that, firstly, C++ actually executes, and secondly, it has a bunch of more useful things than just boolean logic
subjective ideas with no inherent worth
what is someone else's idea of "elegance" worth, really?
 
Prolog is all about: you describe a world and I'll tell you what I know about it
it's pretty cool :P
it takes all the bolierplate of searching for the solution off of your table
imagine you would just give the computer facts, and it'll derive all the rest
 
@DeadMG @DeadMG: That is quite a bit of a statement there. Some times it might be easier to state the logical rules and have a system come up with the conclusions than actually model in a procedural/oo language
 
that's not a good thing, I like and manipulate that boilerplate to get the result I want
 
user379888
which one of the below C statements are correct?
int *ptr=&x,x;

or

int x,*ptr=&x;
 
the second
 
user379888
2:37 PM
To me both of them seems incorrect
 
they might be
but I never really use that kind of syntax anyway
 
I think it's the second one.
 
user379888
Wont it be that the memory will be allocated after the statement ends
 
not sure. you can find out pretty quickly
I would just do it line after line
int x;
int* ptr = &x.
. --> ;
 
One of the navigation systems that NASA sent into space to reach Mars was based on a system were physics were introduced into the system, and then a query was stated: I want to be at this coordinates at this particular time, then the system would solve the thrust to be used in each propeller (whatever they are called)
2
 
user379888
 
by solving the set of rules, the system achieved the correct values for each one of the variables which were then applied to the propulsors (trying a different word now)
@fahad why would both of them be incorrect?
 
@David: Firstly, the use of such a system by NASA really doesn't mean much- they're not some kind of special organizaition, they make cockups all the time like everyone else
 
No, but I found that as a neat real-world use of non-procedural language, that it was NASA is not important, that it worked is.
 
user379888
@DavidRodríguezdribeas: To me memory would be allocated once a sequence point is reached(thats what I think).
 
but secondly, you didn't demonstrate or even state that a program to find the thrust required would be easier to write in that kind of logical language
the fact that a program works is not the only important thing about it- there's also maintainability, performance
2
and it's hardly exclusive to any particular language
 
2:42 PM
@fahad, that would be impossible, as that would require the memory to be allocated after the variable has been initialized
 
user379888
@DavidRodríguezdribeas: good one! So I now vote for the 2nd answer : )
 
I have this: std::for_each(_request->begin(), _request->end(), iterate_nodes);
 
@DeadMG, I just brought the example as I used to think like you, until I went through 3 post-grade courses in AI and resolution calculus, where I started to see that there are real uses of it
 
and then this: void RequestValues::iterate_nodes(boost::shared_ptr<node> node)
my compiler says "term does not evaluate to function taking 1 arguments" about the function past to for_each, why?
 
is it a member function?
 
2:45 PM
the iterator has items of that type that I pass
yes
member function it is
 
there you go
 
@fahad BTW, if you look at the assembly you will find out that in many cases the compiler binds the allocation of both (even all local) variables in a function at once with a single change to the stack pointer
 
you're using a member function and trying to use it as a free function
but it's not
 
@DeadMG so I have to use bind?
 
a member function takes a hidden parameter - this
 
2:46 PM
well, you could write your own function object to do it if you wanted
can be simpler than binding for small cases
 
@AmirRachum I know, I'm just wondering how I pass it then
 
personally, by the time I was advanced enough to need it, I had lambda functions with MSVC10 anyway
 
but i ain't using that compiler
unless I use boost::lambda
 
indeed
most poor souls stuck in C++03 world use bind
 
you calling me "poor" eh? LOL
 
2:48 PM
@Tony, you can take a look at mem_fn or mem_ptr or something like that... I never remember. I use boost::bind that is much more simple (for the user):
X a; // X contains the method
std::for_each( v.begin(), v.end(), boost::bind( &X::f, &a ) );
 
3
A: is it possible to restrict class instances to be used only as temporaries?

DeadMGI think that even wanting to do this is a sign of a really bad design. However, you could make all constructors private and make a friend function that returns an rvalue. That should do the trick.

 
huh
 
the latter part of what I quoted is a (non-normative) note, is there a normative and clear quote which says the same thing?
 
fuck me, I'm glad that I never need that kind of thing
that's bollocks, you never copy it from outside the function f
gargh
RAEG
 
@DeadMG yet "all the semantic restrictions" must still be satisfied
 
2:51 PM
that's the bad part
jesus, how can a Standard commitee produce so many pure pieces of crap?
 
a copy/move might not be elided, it would be surprising if that called an inaccessible or deleted copy/move ctor
 
sure, but you didn't copy or move it
you took it by reference
explicitly not invoking any copy or move
 
there might be an implied copy/move, elision is optional
 
there isn't any implied copy or move
because it's referred to
binding a reference is very definitely in all situations NOT a copy or move
 
there is an implied copy/move when returning by value, §12.8p1 (N3225): "A class object can be copied or moved in two ways: by initialization (12.1, 8.5), including for function argument passing (5.2.2) and for function value return…"
 
3:02 PM
but there's nothing for it to be copied into
so how can it be a copy or move?
 
can you return a value from std::for_each?
 
you're far too on-topic. turned out i had an old conversion program from MIKSOFT. a 122 KB AMR file from phone recording converted to 1824 KB MP3, medium quality. AMR must be very compact format...
 
@Tony: How would you even think about doing that?
you'd have N return values, and only one place to put them
 
@DeadMG I'm not sure....
 
maybe you could push_back into a vector
 
3:09 PM
I'm actually looping through various structures looking for a specific something that I want to return as a string
so maybe my for_each is not really for_each after all, cause the body of the loop will only perform operation on a specific element
 
yeah, exactly
for_each is not the right operation for that
 
that sounds like std::find_if or related
 
so I just have to write my loops I guess
 
for_each is overused, especially in 0x
the new foreach loop syntax is what people really want
 
ah, "idiot's boogie"! :-)
on three string guitar, improvised just to terrorize stooopid neighbour
 
3:12 PM
@DeadMG I can't find the quote in the 0x draft, but most uses of a temporary allow it to be copied multiple times
 
@FredNurk: I have to disagree with that
for_each would be more adaptable- you could swap it out trivially for a loop that, say, occurs during a lock
 
the only one I can think of that doesn't is immediately calling a method or accessing a data member, but you have to construct the temporary just prior to that (instead of returning by value from something)
 
ok, then, i'll look for some question(s) and gain some rep. need that 10.000 for mod tools
 
What's your current rep?
 
sure, but you can still construct inside the function
it's only once you're outside the function and the temporary is already on the stack
as in, the function has already returned and there's an object already on the stack, and now you're binding a reference to it
 
3:15 PM
@DeadMG that's why I left out the implementation of f() in my example: it's the copy in main (rather than in f()) that's the problem here
 
there is no copy or move there
f() put my A onto my stack, and now it's there and I'm going to refer to it
you may as well argue that taking the address invokes a copy
 
argh. instead lost 1 rep on downvoting, stackoverflow.com/questions/4852249/…
@AmirRachum you can just click on users to check
 
@DeadMG you can't take the address of a temporary :)
 
9.3k, nice
 
heh
the Standard says that I can't, but infact I can :P
 
3:17 PM
@FredNurk template<class T> T& getRef( T const& r ){ return const_cast<T&>( r ); }
 
more importantly
if I had an lvalue on the stack, you wouldn't argue that taking a reference to it invokes a copy or move
the lvalue or rvalueness of an object is irrelevant when the actual process of binding occurs, it only dictates what types it can bind to
 
coffee!
 
@AlfPSteinbach and there are other ways to turn a temporary into an lvalue, but the key is you still turn it into an lvalue and then take the address :)
 
@FredNurk yes, lvalue and rvalue are perhaps the most misunderstood concepts in C++ (they apply only to expressions, an object isn't lvalue or rvalue). but hey, what about my boogie? can not anybody spot what's wrong with it?
4
 
@AlfPSteinbach you mean getRef? as long as the original object isn't const, it's highly questionable and against my personal preferences, but fine strictly according to the standard
 
3:29 PM
@FredNurk no, i meant my "idiot's boogie" :-)
 
oh, I have no idea; didn't listen :)
 
3:43 PM
@AlfPSteinbach: Are you talking about the template? I first thought that it was buggy (the temporary would bind to the argument of the function, but then when the function completes you would be left with a dangling reference) But then I thought it over:
type foo();
type const & cr = foo(); // binds to the temporary and extends lifetime
getRef( cr ).non_const_op();
would not have an issue with the lifetime of the object
Then again... I would not really recommend that code, but that is not really a bug of the implementation but rather a bug of a potential use: getRef( foo() ).non_const_op() is not guaranteed to work
 
@DavidRodríguezdribeas I believe he's talking about...
32 mins ago, by Alf P. Steinbach
ah, "idiot's boogie"! :-)
@DavidRodríguezdribeas that is guaranteed to work: the temporary is not destroyed until the end of the full expression
 
@DavidRodríguezdribeas temporary last to end of full-expression
 
@AlfPSteinbach My bad I was doubting... I always doubt with these type of things I never actually use
 
@FredNurk could it be that posted URL doesn't show up ? It's uploadmusic.org/MUSIC/6391871296486561.mp3
and very badly performed, I'm proud to say! :-)
he he...
 
@AlfPSteinbach it did show up earlier, when mentioned alone on a line
 
3:47 PM
oh, theory down the drain
 
4:10 PM
without some chat or another subjective question, I might actually have to get some work done :(
 
Is there a default limit to how much memory a program can use when compiling with g++ on OS X?
 
do you mean a limit on the compiled program, or of the compiler?
 
on the compiled program
 
that's determined at runtime, see man getrlimit
 
@jluebbert With bash you can use ulimit
 
4:18 PM
there are upper limits regardless of runtime; e.g. with 32-bit code, you only have a 32-bit address space
gcc may warn or error on large static data sizes (can't say I've had to worry about that in a long time)
 
4:29 PM
Thanks guys. When I use ulimit I get unlimited. When I used getrlimit() it gave me an extremely large number.
 
0
Q: Comparing arrays of different size

FredOverflowI am implementing my own boost::array variant for fun and education, and I was just wondering: should comparing two arrays of different size yield false, or should it be a type error? array<int, 3> a = {1, 2, 3}; array<int, 5> b = {1, 2, 3, 4, 5}; a == b // <--- false or type e...

 
Does microsoft's "Visual C++" have access to the .NET framework like you would in C# ?
 
@Raynos I am sure that CLI/C++ (which is not C++, but a different language inside the .NET CLR) has access to everything. But then again, that is not C++. What is it that you want access to?
 
4:45 PM
@Raynos Yes and no. You can't access the .NET framework from C++. You can access it from C++/CLI. C++/CLI is officially almost a conforming extension to C++. Unofficially, it's a completely different language that could bear a slight resemblance to C++, but is essentially always used in a ways that are completely different.
 
what's the best way to simulate 2D array's in C++, I assume it's not doing int[][]?
use vector<vector<T>> like this? or is there some other template I can use?
 
@Tony there are almost as many matrix classes as there are string classes
a class that's a light wrapper over a vector<T> data; int one_dimension; is as simple as you get (the other dimension can be inferred): remember how the compiler implements arrays of arrays to implement this
 
@tony: it depends... more work gets you more functionality, efficiency, clear notation, or whatever you desire. i think in general, if you absolutely have to do it yourself, use a single vector and implement 2d indexing on top of that.
@JerryCoffin You can access (at least parts of) .NET from C++ by using OLE Automation, but it's very ugly and very inefficient. In fact I started my StackOverflow presence by asking about some problems with that (I have only asked 3 questions and they were all about that). Nobody had good answer... :-)
 
@AlfPSteinbach Are you calling .NET ugly and inefficient? ;-)
 
@JamesMcNellis Uh, I didn't, but now that you remind me... ;-) He he, flame war!
@JamesMcNellis Actually Microsoft once thought so, apparently. They included in the EULA for Windows Mediaplayer that one promised to not publish measurements of .NET. At least not without a complete rigmarole of specifying all kinds of details.
 
4:57 PM
hello folllks
 
EULAs are so abused
 
@JohannesSchaublitb Hiya Johannes! You missed my "Idiot's Boogie"! uploadmusic.org/MUSIC/6391871296486561.mp3
(Nobody's yet commented on how awfully wrong it is)
 
/([^\/]+?link)/i includes "link" in the output of the regex, how can I make it go up to but not including "link"?
 
@Alf: That's not unreasonable, to request that someone give it a fair hearing
 
5:03 PM
@David19801 Are you using std::tr1::regex?
 
actually its php, but that board is dead :)
if (preg_match('/([^\/]+?link)/i',$data,$_)){
 
Regexes come with different syntaxes
You want forward lookup.
 
@Alf I liked it!
 
@JohannesSchaublitb :-)
 
5:05 PM
hmm...
ok thanks
 
So you want /([^\/]+?(?=link)/
 
5:23 PM
@AlfPSteinbach Well, okay -- if you don't mind restrictions, ugliness, inefficiency, etc. It's one of those situations that leaves me torn between saying "here's how you could, but don't ever do that." and just "you ca't."
 
@FredNurk Yes. I am indeed asking (myself) whether it should be an error or not.
 
@FredNurk Your edit makes more sense than your original.
But I read the original the same way.
 
@Xaade it's not my answer; it's my comments on it
@FredOverflow I think space cowboy is confused and thinking you're using boost::array, then using how boost::array works to justify the answer
 
@FredOverflow one should ask in which circumstance runtime check that always yields false can be useful. for this particular case i cannot think of any?
 
5:35 PM
bool give_me_false_or_give_me_death(); // I hope this runtime check always yields false.
 
@AlfPSteinbach generic code which applies various of the six comparison operators
 
@AlfPSteinbach That was also my take at the question, the user knows when he is writing the comparison the types of the two elements, and as such he/she knows the outcome.... then again, if you use this in a deeply nested template and you accept two size arguments for two different fo::array<> that might not be the case
 
@FredOverflow I'm thinking, it may be a false dichotomy. provide both. == for the runtime check thing, and identical function for that yet-to-be-conceived template code.
 
@JamesMcNellis you mean like assert? true or die! :)
 
@FredNurk Considering that I don't know what's in your head. It appears that the others disagree and think that it's more about receiving any errors at compile time, than saving processing time checking for equivalency that's always false.

However, given if a compiler were smart, and understood that any errors would occur during compile time, it would mean that the code would never be used at run time, and the compiler could skip compiling it.
 
5:39 PM
no, the compiler can't skip compiling it, but dead-code elimination can remove it
same as if (false) { this_must_be_compiled_and_checked_to_the_extent_required(); }
 
@FredNurk Dead-code elimination?
 
yes
 
@FredNurk The result is the same.
 
it is not the same for required diagnostics
 
@FredNurk You make sense to me.

You mean to say that you can't expect what the user of your class would want an equivalency to do at compile time.
Nevermind that. He would lose the benefit of the op== if he could upcast.
Crap. or would he?
 
5:53 PM
there is no base class to upcast to, at least none is mentioned in the question
 
Sorry, I was thinking C#
@AlfPSteinbach I like this answer.
 
@FredOverflow I like how Jerry's comment is ambiguous in "yes, it should" :)
 
6:13 PM
@FredNurk Deliberately so...
 
it took me about 5 times of reading it before I saw that :(
 
@Fred: ambigious, but IMO correct. He said essentially the same as me.
 
@FredNurk same here
 
6:55 PM
why do you think this is downvoted? stackoverflow.com/questions/4854503/…
 
@JohnDibling I'd guess it's somebody who frequently initializes data in the body of a ctor, and didn't like being called a "punk" (especially because it's probably accurate!)
 
@Jerry: nothing technically innacurate? i havet slept much :)
 
No, I didn't see any technical inaccuracy.
 
I replaced the upvote.
I can't find anything wrong.
 
@Xaade: thx. Uncommented downvotes bug me because of something is wrong with the post, then i'd want to improve it. I appreciate the boost tho.
 
7:03 PM
I can't even see a reason to commit a jealousy downvote. No one has a competing answer that provides adequate info.
So, I can't find a motive at all.
You actually give a good textbook reason, instead of just giving the right answer. That seems to be the kind of answers we're looking for.
 

« first day (107 days earlier)      last day (4842 days later) »