« first day (484 days earlier)      last day (4465 days later) » 

2:00 AM
@je4d the thing with concurrency is that you'd actually better not try to verify 'correctness' by empirical methods. That doesn't work out well. It produces heisenbugs (stuff that only crops up when you switch processors, or change thread affinity, or compile with more/less optimizations, or just try it on a different day)
 
@sehe Yeah, I'd never try to prove correctness by example :)
 
@je4d mmm the same goes for proving correctness of understanding
 
I was talking about trying to make test programs that break without the barriers, to test my understanding
@sehe true, but what more can you do? I googled for a cpu simulator that did pathological reorderings ;-)
(didn't find one)
@sehe well, you can prove correctness of understanding in one direction - knowing that certain constructs are broken, just not that other are correct
 
user868935
Well, word to the wise: 1. Stop trying to act like you are the next Mark Zuckerberg and be the first (insert name here). 2. Smart men plays dumb (so stop trying to show off in class). 3. Stop trying to asking inappropriate questions that are out of the scope of the class. 4. Even if you are more talented than your peers, keep your ego out of group projects. 5. Be humble. 6. Listen to others (big problem in computer science).
 
@je4d true
(big problem in computer science human species). FTFY
 
2:06 AM
@sehe lol
 
@Paul Where does it show you the error? Can you pastebin the exact source? What compiler?
 
user868935
Error 2 error C2197: 'void (__cdecl *)(void)' : too many arguments for call c:\program files (x86)\microsoft visual studio 10.0\vc\include\algorithm 22
 
@Paul I have just dropped the code unmodified into a C++ Console App project using VS2010 SP1 and it worked no problem. (Actually, I added #include <stdafx.h> braindamage at the top...)
 
user868935
Ill try adding that
 
@Paul I'm suspecting you are f*cking up the 'somefunction' signature. It looks like you 'accidentally' changed that to void somefunction()?
 
user868935
2:12 AM
@sehe are you talking about the prototype or the actually function?
 
In fact, when I remove the parameter from that function, I get exactly that compiler message :)
@Paul Does it matter? They should match. Anyways, it is the declaration that is visible at the time that the compiler complains that counts
 
user868935
They match just like your posting
 
@Paul Yeah, but do they have a parameter? I'm pretty sure they don't. Just copy and paste the whole d*mn source into pastebin.com
 
Hi, I'm looking for a reference for the following line of code. In
2
A: iterate over tuple

emsrI have an answer based on Iterating over a Tuple: #include <tuple> #include <utility> #include <iostream> template<std::size_t I = 0, typename... Tp> inline typename std::enable_if<I == sizeof...(Tp), void>::type print(std::tuple<Tp...>& t) { } temp...

inline typename std::enable_if<I == sizeof...(Tp), void>::type
 
@Paul Look, void (__cdecl *)(void) says: I have a function pointer to a function XXX with signature void XXX(), and you're calling it with too many arguments
 
2:16 AM
The sizeof...(Tp) presumably means the length of the para pack. What is the syntax governing this?
Specifically, why the brackets?
I'm trying to learn about variadic templates. If anyone knows a good link let me know.
 
@FaheemMitha sizeof...(Tp) is the length of the pack, correct. But I'm not sure what you mean by "this" in "What is the syntax governing this"
 
@FaheemMitha The brackets are for template declaration/use in general. Learn about them first
 
@FaheemMitha Andrei did a talk on them at GoingNative last week, it'd be a good starting point channel9.msdn.com/Events/GoingNative/GoingNative-2012/…
 
lol
 
@sehe lol
were you there?
 
2:19 AM
no
@FaheemMitha To learn about tempaltes in general, parashift.com/c++-faq-lite/templates.html
 
Thanks for the reference. I hope it is downloadable. It looks like it.
 
@FaheemMitha yup, there slides are there too
 
@FaheemMitha Sure
 
I have some basic knowledge of templates. In this case, just wondering why not sizeof(... Tp)
 
@sehe we're being a bit redundant here ;)
@FaheemMitha sizeof... is a slightly special case of the expansion operator (...)
 
2:22 AM
Ok I'm officially out-a-here (@Paul good luck bug hunting, leve me an @message and I'll find it tomorrow)
 
@sehe nite
 
@je4d that was not in response to that :) Nite
 
@je4d : Ok. I guess I'll watch the talk first. Thanks for the links again.
 
@sehe good luck actually sleeping this time
 
user868935
@sehe Prototype: void somefunction(); in a headerfile. void somefunction(const std::string& s)
 
user868935
2:23 AM
@ok bro
 
user868935
@sehe ok bro
 
@Paul So, I was right. It is parameter less (ouch) and _they didn't match.
 
@je4d But do you have a reference link for sizeof...?
 
user868935
@sehe how do I match it?
 
2:23 AM
@Paul use a text editor?
 
@sehe mornin'
 
user868935
@sehe I mean somefunction(string); something like that?
 
user868935
@sehe for the header file I mean
 
@FaheemMitha Or the specs § 5.3.3, ad 5:
The identifier in a sizeof... expression
shall name a parameter pack. The sizeof...
operator yields the number of arguments
provided for the parameter pack identifier.

The parameter pack is expanded (14.5.3) by
the sizeof... operator. [ Example:

    template<class... Types>
    struct count {
        static const std::size_t value = sizeof...(Types);
    };
@Paul void somefunction(const std::string&) would be start
 
user868935
I feel like yelling like Charlie Brown.... lol
 
2:28 AM
@FaheemMitha there is 14.5.3 Variadic templates in the latest specs (open-std.org/jtc1/sc22/wg21)
@je4d morning :) afk
 
user868935
@sehe something else is going on... still getting an error, but you did help me a lot. I will see if I can find this error.
 
@Paul aw just give it :)
 
user868935
@sehe My whole program?
 
@Paul Let's start with the error
 
user868935
@sehe Error 2 error LNK2019: unresolved external symbol "void __cdecl somefunction(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?somefunction@@YAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@st‌​d@@@Z) referenced in function _main C:\Users\Paul Lewis 2\Documents\Visual Studio 2010\Projects\Cryptonight\main.obj
 
user868935
2:33 AM
@sehe thats from adding const std::string& to the prototype
 
user868935
everything else is just like you typed it
 
@Paul No it's not from adding that, it's after or since adding that :)
 
I think im getting the hang of this thing called "C++"
 
@Paul There's one thing I can guarantee is not the case :)
 
user868935
@sehe Then it my be: for_each(istream_iterator<string>(readFile),
(istream_iterator<string>()),
somefunction);
 
2:35 AM
Thanks for the references everyone
 
@Paul looks ok
 
fruhling... that looks like german for spring
 
@Paul is your definition of somefunction(const std::string&){...} in the same file as your main()?
 
@Hoxieboy Frühling
 
yes
 
user868935
2:36 AM
@sehe No. it's in a different header file
 
@je4d I'd say so: `everything else is just like you typed it` :)
 
user868935
but all header files are called into main
 
@sehe Actually, just you I guess. :-)
 
@Paul That should be @je4d
 
user868935
into my main file
 
2:37 AM
@FaheemMitha No @je4d helped
@Paul Why would you define a function in a header when it is already declared in a(nother) header?
 
user868935
@Je4d My bad. They are all in header files. no functions in main file
 
@C++ way to have 5 different ways to declare the same type of int ;)
 
@Paul You don't call headers, they are included. That is preprocessor operation (i.e. it is text only)
 
@Paul is the actual definition in a header, or just the prototype?
 
@Paul Except main?
@Paul And let me guess, you included stdafx too, but after including the definition (implementation) of somefunction?
 
user868935
2:39 AM
@je4d they are all included
 
@sehe what documentation of C++ would be best to learn about/with, C++10?
 
user868935
@sehe no
 
@paul check your headers all have unique include guards
 
user868935
???
 
@Paul Anyways, indeed you'll be able to work it out from here. If only by first retreating to the actual code that works, and gradually modifying it to your needs. Re-compile every step on the way so you'll notice when you break things
 
user868935
2:41 AM
everything works accept that code with the for_each
 
1
A: Error: method was not declared in this scope (but is is included)

seheYour problem is that you have duplicated the header guards from f1/common.h in f2/tcommon.h. Change these to (in tcommon.h): #ifndef TCOMMON_H #define TCOMMON_H //... #endif // TCOMMON_H and the problem is fixed, the program builds and you can run it. In response: http://downloads.sehe.nl/s...

@Paul I.e. nothing works
Everything 'compiles' without that line. Meh
 
user868935
yes
 
@Paul that Q sehe linked was what i was talking about
 
@Paul I posted that linked answer as an example of what can go wrong with header guards
 
user868935
ok
 
2:43 AM
Off with his header
 
user868935
I already have those in my headers
 
@Paul What you have to check is that you don't have identical ones in two headers
 
@sehe Its going to be hard to adjust to C++ for loops :s
 
user868935
@je4d Ill check it out
 
user868935
@je4d checked all headers. no duplicates. same errors: Error 2 error LNK2001: unresolved external symbol "void __cdecl somefunction(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?somefunction@@YAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@st‌​d@@@Z) C:\Users\Paul Lewis 2\Documents\Visual Studio 2010\Projects\Cryptonight\main.obj
 
2:53 AM
@Paul If you know how to, look at the preprocessed output for your main.cpp and check that void somefuncton(const std::string&) { ... } is in there
I can't tell you how to though, I don't use VS
 
I'm noticing a similarity/pattern to java when coding c++
 
user868935
Im reading that right now lol
 
3:09 AM
I finally understand :s it has to be a void definition in C++ to be called as a function
like void addnumber(){
#import <iostream>
using namespace std;
int n = 10;

void increase(){
for (n; n<20; n++){
cout << n << endl;
}
}

int main() {
cout << "Int n is: " << n << endl;
cout << "Let's run the void definition increase()" << endl;
increase();
cout << "Int n is now: " << n << endl;
cin >> n;
}
 
@Hoxieboy You're doing it wrong :)
 
@StackedCrooked ?
 
formatting
 
@Mysticial I do want to know how to code format code snippets :s
I know its the apostrophe symbol, but what about large sections (multi lined)?
 
@Hoxieboy Check the newbie hints.
make sure you indent everything by 4 spaces, don't miss any lines.
 
3:16 AM
I see
 
Also the formatting doesn't work when combining code with regular text.
For example:

class test{};
 
or just hit the "fixed font" button when you're done typing/pasting
 
Even though I used 4 spaces to indent the code. It is not formatted.
 
    #import <iostream>
    using namespace std;
    int n = 10;

    void increase(){
         for (n; n<20; n++){
             cout << n << endl;
             }
    }

    int main() {
        cout << "Int n is: " << n << endl;
        cout << "Let's run the void definition increase()" << endl;
        increase();
        cout << "Int n is now: " << n << endl;
        cin >> n;
    }
I see
useful!
its been scratching at me for so long now I know XD thanks
I think I have a major advantage in learning python before C++, I think it is definitely helping me learn the quirks of it :/
 
user868935
3:43 AM
@ je4d I tried to get the preprocesser output, but the tutorials are too butchered
 
@Paul oh well :-/
 
user868935
@je4d thanks for the help though
 
you could put a #error in the file with the definition, to check it's being built
if main.cpp still compiles with it, then it's not being #included somehow
 
user868935
whats not being included?
 
the function definition
anyway, i have to sleep...
at this point you're probably best off just putting the lot up on a pastebin for someone to look at
better than us trying to guess what's wrong
 
user868935
3:53 AM
this is the same code I'm using from sehe: codepad.org/f7qhHvvX
 
@Paul but the code isn't the problem - it's a matter of what's in what file and how it's being built
 
user868935
ok
 
4:13 AM
@je4d gcc461
@je4d and the std::unique_ptr code gives the same error.
 
4:44 AM
Hi. In the example in en.cppreference.com/w/cpp/types/enable_if, namely
// foo1 overloads are enabled via the return type
template<class T>
typename std::enable_if<std::is_floating_point<T>::value, T>::type
foo1(T t)
{
std::cout << "foo1: float\n";
return t;
}

template<class T>
typename std::enable_if<std::is_integral<T>::value, T>::type
foo1(T t)
{
std::cout << "foo1: int\n";
return t;
}
What kind of overload is this?
Doesn't look like a regular function overload.
 
@FaheemMitha Its using SFINAE if that's what you mean
 
@Pubby Are you replying to me?
this can be used as a form of template overloading, to choose between different templates?
 
Well, it's template function overloading
 
5:04 AM
@Pubby Regular functions cannot be overloaded solely on their return type. It seems the rules are different for templates.
 
@FaheemMitha The rules should be the same for templates, however with SFINAE the other overloads fail.
 
@Pubby If both templates worked for a specific instantiation, then would the compiler signal an error?
 
@FaheemMitha I think so, let me test it
@FaheemMitha Yeah, it's still ambigious
 
@Pubby : So the compiler objects to the ambiguity?
Trying an example myself.
 
If it's ambiguous then yes.
 
Xeo
5:16 AM
@FaheemMitha SFINAE removes a function from the overload set. For the particular case above, there will only ever be one function in the final overload set, because the other was removed. There's no type that is floating point and integral
 
@Xeo Right, I understood that.
However, if there is potential overlap, but there is no instantiation corresponding to that overlap, is the compiler able to detect this?
 
It won't detect it until you instantiate the template
And even if there's an overlap of some types others can be correct
 
@Pubby Ok, that's what I thought. Thanks.
So, this has some potential to blow up in a users face then.
 
All templates do
 
@Pubby Right.
And these rules live alongside the usual function overload rules, since non-template functions are always preferred over templated when it comes to making a choice.
 
5:22 AM
Yes
 
Ok, I think I understand now.
 
 
1 hour later…
6:36 AM
So it looks like the whole idiom of using static member functions for callbacks from C APIs is broken?!?
1
Q: C++ class member function and callback from C API

NewGuyI am trying to learn how to call this write_data(…) function from the funmain() function in the class as shown in the code bellow. (I know this program works if I just list these two functions without putting it inside a class). curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data) line giv...

 
Xeo
6:52 AM
@BenVoigt Yes
 
user868935
7:29 AM
あれ!あれ!
 
Xeo
Nani?
 
user868935
Just checking lol
 
dare?
 
user868935
 
Xeo
Now it's getting complicated for me... "watashi" is about the only Kanji I recognize. :(
 
7:35 AM
@Xeo I can do only slightly better than that with my Chinese background... but not by much...
 
user868935
すごいよ!
 
@Paul I can probably understand a lot more if you write it in romanji...
 
user868935
私の日本語が便利だ。
 
Xeo
@Paul Hm, the "go" is hard to distinguish from "ko" in my fontface..
 
user868935
watashi no nihongo ga benri da.
 
7:37 AM
@Paul I can read the first 5 characters of that. lol
 
Xeo
Ha, I could atleast guess the "nihongo"!
 
user868935
lol
 
Xeo
I know "ni" and "hon"
 
user868935
one more semester and I will have my AA
 
Actually, if you read 私の日本語 in Chinese, but using 的 instead of の, its a correct start of sentence. lol That's why I understood it.
 
Xeo
7:40 AM
I want to learn Japanese too. :/
 
0
Q: How do I build Lynx with SSL on Mac OS X?

MosheI'd like to build and install Lynx on Mac OS X. I've found out that building is as simple as running ./configure, but I'm having trouble building with SSL support. I've downloaded openSSL. How do I include it in my build?

 
wtf? "My Japanese is convenient?"
lol
日本語能力試験を受ける方がいいかもしれない。
 
I just wanna be able to watch Anime without subs... Don't see that happening anytime soon... lol
Although there are a number of shows where you really don't need to understand what they are saying...
 
that's because too many anime use crazy teenager slang...
...some adults don't understand what they're saying
if you really want to learn, it's a good idea to start with hiragana あいうえお and with Romaji. Then get into Kanji within the first 2-3 years - dip your feet in asap
 
@kfmfe04 Yeah... sometimes it gets to the point where I really don't even need to look at the screen at all. And all I hear is kisama, temee, followed by some kinda of weapon sound and explosion of some sort.
 
7:55 AM
well, if that's what you're going for, then you don't need to learn Japanese at all...
I lived in Tokyo for six years before moving to Taipei. After I finish my project, I will try going to Japan again - it's an interesting place to live (if I can stay way from the meltdown in the NE)
 
A lot of the time, I hear a sentence, but I understand less than 10% of the words... But I can still get a "feel" for it - enough to know what's going on... (I don't normally watch Anime without subs, but it's usually running on my 4th monitor where I'm not always looking.)
 
Xeo
@Mysticial I want to read Light Novels in Japanese. :/
 
@Xeo do they have Bookoff where you live? I heard they've expanded to the US (maybe NYC)... ...you can buy used Japanese books for cheap there...
...for about a dollar you can buy stuff
 
Xeo
@kfmfe04 Well.. that doesn't allow me to read them without knowing Japanese. :P
 
@kfmfe04 Oooh... so you're proficient/fluent in Chinese and Japanese? (and assuming English too since you're chatting coherently.)
 
8:01 AM
@Mysticial conversationally, I can do ok - my Japanese is better than my Mandarin
the written language and grammar (in the case of Japanese) are the real challenge
Chinese has practically no grammar
@Xeo one-step-at a time, just like for a computer language
 
Yeah, Chinese sentence structure, for the most part, is pretty simple... There's are some things in conversational Cantonese that get complicated. I'm not sure if they exist in Mandarin though, of if they're just never used.
 
Most the Chinese dialects have grammar in the form of patterns, but they're not that hard if you've seen or heard them a few times - otoh, Japanese has nasty conjugation rules for verbs, not unlike European languages and tons of politeness levels - I asked a friend once - there's something like 15-20 ways (maybe more) to say "I" in Japanese
 
I only recognize about 10 forms of "I" when I hear them... But only like 4 of them are common (in Anime).
 
8:40 AM
Wait, what's type erasure mean in C++?
 
std::function<void()> f = foo;
std::shared_ptr<T> p { q, some_deleter {} };
 
How do they erase the type?
 
A kind of polymorphism where an object can be constructed from several types, as long as those types comply to some requirement.
27
Q: Type erasure techniques

Xeo(With type erasure, I mean hiding some or all of the type information regarding a class, somewhat like Boost.Any.) I want to get a hold of type erasure techniques, while also sharing those, which I know of. My hope is kinda to find some crazy technique that somebody thought of in his/her darkest ...

This delves directly into the gritty details, not the end goals of type erasure, or even what it looks like to the user.
 
I will read that, thanks.
Although I don't really see why you would want to manually erase types
 
How do you store arbitrary callbacks into a container?
Also I don't really know what you mean by 'manually'?
There's no language feature to replicate what std::function and the like is doing under the covers.
 
8:47 AM
I mean the programmer erasing the types instead of the compiler
And yeah, std::function is good, but having the language support function types seems even better
 
@Pubby That doesn't make sense.
 
What?
 
If you use typeid then you will always get some type information.
 
I'm not a fan of typeid, although I guess you're right
 
9:32 AM
it would be nice to have features X, Y and Z, but how would you implement them?
 
sbi
9:53 AM
:2612107 Sure, I'm there. The question is whether I'm here, though. :)
 
@sbi lol , I have little question in C# regarding some concepts, can you help please?
 
sbi
@MrAnubis I doubt it. Have you tried the C# room?
 
@sbi yes , those zombies are sleeping I guess
 
sbi
Lemme have a look over there.
@MrAnubis Well, you haven't asked any question?
Oops. Battery dying. I'll be right back...
 
good morning :)
 
9:59 AM
@sbi KK , thanks anyways:)
 
mawning
 
I hate paper boooks
my Algo book is never around when I need it
 
I LOVE paper boosk
lol
 
well they are hard to move
"Variety is essential to stay healthy, that's why I code Java on the job and C in the evening"
read today
 
10:14 AM
A person who codes C and Java is a very unhealthy person
 
10:52 AM
@Nils Paper books give you the mental and the physical workout at the same time!
4
 
@wilhelmtell weird... I've got 4.6.1-9ubuntu3 installed and it behaved as expected for me - I get that error if I omit std::move, but otherwise it compiles.
 
11:07 AM
with all the talk about how much electricity a google search uses, I wonder how much energy is lost from google ads (especially ones that no one ever looks at): the carbon footprint must be significant...
 
11:20 AM
int c[3], i; - I hate the language where people can write such stuff =\
 
I hate people who write such stuff.
 
people write it because they can write it
 
Then those are stupid people who shouldn't be programmers.
You can write awful code in any language.
 
oh really?
 
Sorry, but if the sole reason for writing awful code is "because I can", then that's just stupid.
 
11:27 AM
That kind of idiom is just fine in FORTRAN.
 
it's from Lua source code. it looks like a crap, but it'd better that we have Lua, rather than it would never be written.
 
So is int c[3]; int i; not valid lua?
 
also, probably any C program have such code
@FredOverflow it's C.
 
49 secs ago, by Abyx
it's lua source. it looks like a crap, but it'd better that we have lua, rather than it would never be written.
Didn't you say it was lua? :)
 
fixed.
 
11:29 AM
I still don't see the point. Just don't write int c[3], i; and you're fine.
 
I didn't wrote it, and I don't write such code.
the point is that C/C++ allows to write such code, and people write it
 
as I keep saying a tool which could check code style conventions automatically would be helpful
just make it complain before checking in
 
@Abyx Then simply have a style guide that forbids such code.
 
we need a compiler with #pragma strict syntax [push|pop], enabling only a subset of C++ syntax
 
That would only work for really small projects.
 
11:34 AM
@FredOverflow I have such "style guide", but it don't help when I refactor code written by other people.
@FredOverflow why so?
 
nah just have a code style checker before or after compiling
that would be great
so far I could not find one
 
#include <third/party.hpp>
#pragma strict_syntax(push)
... your code ...
#pragma strict_syntax(pop)
 
@Abyx Because large projects almost always involve some legacy code base or external code. There will always be a couple of lines that break your subset. Maybe even the standard library.
 
@FredOverflow that's why it's pragma, not a compiler option affecting whole TU
 
How do you make a dozen people agree on a common subset?
I have never encountered a coding standard that I agreed with 100%.
 
11:37 AM
ok, #pragma enable_feature(feature, (disable|enable), (push|pop))
 
How many distinct "features" would there be?
 
@abyx I would be interested in such a solution, have you done any research on how to implemented.
 
@FredOverflow dunno.
@Nils no, I haven't
 
Maybe open a question at SO?
 
it will be off-topic, or not-a-question
like this -
2
Q: C++0x legacy code problem

AbyxAs all you know, C++0x can't bring lots of important changes because of legacy code: all legacy code (including C code) can be compilable with a C++0x compiler. So why don't add something like #pragma syntax(language_version), which will allow new syntax with breaking changes? #include <lega...

 
11:48 AM
You know, there are sections of the standard describing incompatibilities with C and previous versions C++.
@Nils Probably someone needs to integrate the content of a C++ style book into the compiler, to recognize the same syntactic and semantic patterns that a human reader sees. Then the compiler and user can have a dialogue.
 
no, it's not "patterns", it's features, like having multiple variables in one declaration. (or "definition"? can't remember that)
 
That's a syntactic pattern.
 
you can take parser, and wrap code implementing that features in conditionals, checking if they are enabled
 
Would slow the compiler down
 
No, the code implementing that won't all be in a tidy, self-contained block, and yes, you wouldn't want to slow the compiler down.
Hence, use pattern matching.
 
11:56 AM
parse_type();
parse_var_name();
if (enabled) {
    while(parse_comma())
         parse_var_name();
}
- something like that
 
int a, b; // good style
int *c, d; // bad style
 
the first one is not good style, IMO.
 
You won't get far without some subtlety, and this is a super simple example.
In a function with dozens of variables, you might not want to dedicate one line to each declaration.
 
a function with dozens of variables is a bad function.
 
@Potatoswatter Raw pointers? Where we're going, we don't need raw pointers!
 
11:58 AM
@FredOverflow owning raw pointer, FTFY
 
Also, it's useful to tie together the types of several variables so they're all in sync and can be altered with one source change.
 
std::decay<int*>::type c, d;   // problem solved
 
Then what about std::decay< int & >::type c, d;?
It would be nice if they'd kept std::identity.
3
 
@Potatoswatter You mean like g++ -Weffc++? That puked on lots of standard library code, IIRC :)
std::add_lvalue_reference<int>::type c, d;   // problem solved
But when did you actually need multiple reference variables that were not parameters?
 
@FredOverflow No, I mean create the content fresh for interactive use. So the book is built in to the compiler.
 
12:02 PM
That is much easier to read
 
@FredOverflow I just made up a pathological case because you used decay as a surrogate for identity.
 
@Potatoswatter Sure std::identity would be very nice to have.
 
Why was std::identity removed?
 
Although, I can think of one time I had a long section of code which did the same thing twice on two different, randomly scattered sets of variables. I turned it into a loop which iterated exactly twice, and assigned a bunch of references at the beginning to choose which variables.
 
Too hard to implement?
 
12:05 PM
@Potatoswatter That sounds rather weird. How about two function calls instead?
 
Yeah… but I think there were too many local variables. A lambda function could capture them, and call that twice, though.
 
Cool, another use for lambda functions :)
 
I wonder if there is anything like tree.js for C++
 
@Potatoswatter Oh my god, how long is that function?!?
 
12:09 PM
Er, it's still a loop. Looks like I eliminated the references and simplified it by a factor of a few.
@FredOverflow Looong. Looks like 250 lines. I tend toward long functions.
In my own private code anyway. I can write the other way too ;v)
 
I already have a bad feeling writing functions that are 10 lines long :)
 
The way I see it, jumping to the beginning of a new function decreases readability, and preserving the scope structure helps flexibility, giving more wiggle room even if just for debugging.
But, it's a fairly weak preference. That particular function could easily be split into stringize, concatenate, and substitute. Which are just the subtitles in the comments.
 
Ell
hi guys :)
has anyone used boost::multi_array before? I'm struggling with the documentation :S
 
12:24 PM
boost::multi_array is quite confusing. What do you need it for?
 
Ell
well holding a tile map (3d)
 
How about a std::array<std::array<std::array<Foo, width>, height>, depth>?
 
can i ask an assembler question here?
 
Ell
it can't be resized though can it?
 
@coolbartek Yes, but you can't ask a question about asking a question.
 
Ell
12:28 PM
and it wont be one big contigious memory store, or will it?
 
@Ell Why do you need to resize a tile map? Yes, it will be contiguous.
 
Ell
I was reccomended to use a boost::multi_array after using a std::vector<std::vector<std::vector<int>>>
 
@Ell It will be contiguous.
 
12
Q: Three.js ported to native code?

slfI've been playing with WebGL quite a bit lately and I really dig Three.js. It's really lightweight and just serves as something that makes wrangling most of the GL calls a bit easier, and provides a quick way of creating basic primatives like a sphere. Now, in native land, it seems that all the...

humm
 
But then again, how can you resize it if it is contiguous, whatever you use?
 
12:29 PM
You cannot resize a std::array, the size is part of its type.
 
Ell
@Potatoswatter well it could re-allocate the whole thing. not for when the game is running, but during editing. I just thought it would be easier to use the same class when editing/running the game
 
push ecx
push dword PTR OFFSET text
push dword PTR 1
call __write
add esp, 12

what does add in this situation?
 
Push the stack frame. You are probably using a calling convention where the caller is responsible for cleaning up the stack frame, like cdecl I believe.
 
and why 12?
 
parameter 4, parameter 4, return address 4
 
12:31 PM
thanks :D
but wait
i had 3 parameters
 
Ell
@FredOverflow what reason is there to use array<array<array>>> over multi_array?
 
the size of the char array, the text itself and the handle
 
@coolbartek Well then it's probably 3 parameters, the return address is probably already popped by the callee. I'm not an expert on calling conventions.
 
ok :)
thanks Fred
 
A quick Wikipedia research indicates that this is indeed the case.
Just google for "cdecl".
@Ell array is part of the standard, and everybody understands it.
 
Ell
12:35 PM
@FredOverflow okay - well I'll look into it
anyway im off - bye bye
 
12:55 PM
Anyone know if lambda calculus allows shadowing?
 
Pretty sure that it does, yes.
 
@Pubby What's shadowing?
 
Yeah, it does. Confirmed on free/bound variable wiki page.
@Potatoswatter int x; { float x; }
The float shadows the int
 

« first day (484 days earlier)      last day (4465 days later) »