« first day (491 days earlier)      last day (4443 days later) » 

6:00 PM
@Rookie try -msse2
for gcc
 
Tin
 
@Fanael Oh, have compilers become so smart already? Cool.
 
user784668
@Rookie -msse2 -mfpmath=sse
 
@Tin You didn't seed the engine, it always starts with default state.
 
user784668
@FredOverflow One of AMD64 ABIs require the compiler to use SSE.
 
6:01 PM
@Fanael uh, for all floating point operations?
 
user784668
@rubenvb Yes, except for long doubles.
 
@Fanael im using visual-c++, does it use SSE by default?
 
@Fanael Are you a compiler writer by any chance?
 
user784668
@Rookie In 32-bit code, you have to pass /arch:SSE2 if I recall correctly.
 
user784668
Oh wait. The second AMD64 ABI (the one used by Windows) mandates SSE, too.
 
Tin
6:03 PM
@CatPlusPlus, thanks. so this should be then the correct way to use the std::mt19937 and the std::uniform_real_distribution => pastebin.com/3gMhEd6r , right?
 
user784668
@FredOverflow No.
 
Automatic vectorisation is still work-in-progress in GCC.
In LLVM probably too.
 
What do you guys think about this for function declaration syntax?
[]function_name(args)
 
@Fanael Then why are you so well-versed in ABIs? :)
 
every function can be used as a lambda-like object when needed.
 
user784668
6:04 PM
@CatPlusPlus In GCC, it already works for some cases. In LLVM, dunno. Last time I checked, they had no vectorization at all.
 
@Tin Yeah, or create the engine once in main and pass it along to doSomething.
@rubenvb Sucks.
 
@Fanael llvm.org/docs/doxygen/html/Vectorize_8cpp_source.html seems like there is at least top-level support
@CatPlusPlus Why?
 
@Fanael Isn't SSE without vectorization kinda pointless?
 
@Fanael thx, found it, wasnt on by default :o and it got 1 second faster too!
 
Automatic vectorisation.
You can still vectorise manually.
 
6:05 PM
@CatPlusPlus What compilers do that?
@CatPlusPlus And then programming SEE becomes a little harder with the intrinsics, right?
 
@rubenvb It only makes sense if the [] is used as a capture list to explicitly manage the lifetimes of, well, captured variables. Even then I think it could look better.
 
@Fanael are there any drawbacks using this SSE2, will other users have problems?
 
user784668
@FredOverflow Intel and modern GCCs certainly do.
 
Tin
@CatPlusPlus, thanks!
 
The only drawback to SSE2 is that ancient CPUs don't support it.
 
user784668
6:07 PM
@Rookie If they use a CPU which does not support SSE2, then you'll get undefined opcode exceptions. Other than that, no.
 
@CatPlusPlus can they still launch my program...? do i need to compile 2 exes?
 
I don't know if there are still-manufactured 32-bit chips without at least SSE2 support.
Hell, I don't even know if 32-bit chips are still manufactured.
 
people are still using 10 year old computers, so its a problem :p
 
@LucDanton ok. I kind of completely just took the C++ lambda syntax. Can't seem to find useful syntaxes on the web I could steal from. Any ideas?
 
Depends on what your app is.
 
user784668
6:08 PM
@FredOverflow If it is, then why did Intel implement scalar SSE instructions?
 
@rubenvb Function literals, rather than function definition syntax.
 
@Fanael I don't know :)
 
SIMD is most useful when you actually use the 'multiple data' part.
 
user784668
@FredOverflow Why not? I'm not a professional compiler writer, but maybe some day...
 
@Fanael do you mean i need to compile my program with different settings for those users that dont support SSE2 ?
 
6:10 PM
Or you can not care about users without SSE2.
 
@LucDanton as in function name(args){definition}?
with a functionkeyword?
 
name = fun x y z { ... }
 
@rubenvb If the name is part of it, it's not a literal.
 
user784668
@Rookie Yeah. Or listen to @CatPlusPlus and screw them.
 
@CatPlusPlus @LucDanton aha, ok.
 
6:12 PM
foo = [](x, y) { return x + y; }; e.g. if you don't want a function keyword.
 
[] is fugly.
 
(That [] can be optional, maybe.)
 
C-based syntax is fugly.
 
@CatPlusPlus Yeah I'm not advocating this syntax, I'm reimagining lambda expressions as generalized function literals as an example of function literal vs function definition.
 
Can we get rid of C-based syntax.
 
6:13 PM
@Fanael SSE2 came at 2004 ? i think i bought my CPU at 2005 and im STILL using it :p
 
@LucDanton I know, I know.
 
@CatPlusPlus I don't think it's that bad really
What to use as a capture list then?
Cause I want both function things to be used with the same syntax (lambda stuff and "regular" functions, where the difference should fade away)
 
Don't be C++, close over a scope.
 
@CatPlusPlus No comprendo :s
 
Whether you want/need capture lists depends on what you design your language to be.
 
6:15 PM
@Rookie SSE is from 1999, SSE2 is from 2001.
 
@LucDanton oh, you mean, automatically "capture" what is in scope of the "lambda" declaration?
 
A.k.a. close over, as in create closure.
 
Most languages do that, yes. C++ is pretty much unique with its capture lists.
 
what's the reason then for explicit capture lists? More fine-grained control preferred over simple syntax?
 
Because of manual low-level memory dabbling stuff.
 
user784668
6:18 PM
@rubenvb Low-levelness of language.
 
wtf? That is not a reason
 
Yes, it is.
 
Tin
@CatPlusPlus, and how could I hide to the user the fact that one needs to initialize once the generator? I was thinking of a function that does the job, something like the doRandomDoubleInterval in pastebin.com/sAWNr68u note that it's only an illustration of what I would like to achieve
 
Well, that's not a reason I understand :P in the current context
 
user784668
@LucDanton PHP has capture lists too, IIRC.
 
6:20 PM
@Tin Functions that use the generator should take the generator as an argument.
Don't try to hide it.
 
How eager would C++ implementors be in implementing closures 'the right way', out of curiosity?
 
It doesn't make anything easier, and just introduces new set of problems.
@Fanael AFAIK, no.
 
user784668
 
Also if I do { int i = 42; return { [] { return i; }, [] { return i; } }; } how long does i live?
 
@Rookie You bought a QuadCore in 2005?
 
6:22 PM
@Fanael Oh, right. Forgot about that.
 
@FredOverflow im not sure... something like that
 
But PHP is broken, so that's not a good thing.
 
I wouldn't have thought that QuadCores have been around for 7 years already.
 
hm, i will check
 
(Actually I have to specify () -> int& to make my previous example relevant.)
 
6:25 PM
Core2Quad is from 2008 according to wiki.
Intel page for Q6600 says Q1'07.
 
probably 2007 then
9/2007 to be precise :P (found the receipt)
 
Does UNinitialized value ( or smth else ) NULL value?

In debugger it shows 0xcccccccc

Can uninitialized variable be not only 0xcccccccc ?
 
Tin
@CatPlusPlus, ok, it's because in the following code pastebin.com/3gMhEd6r, I wanted to avoid initializing engine each time doSomething() gets called (note that the engine is initialized inside of doSomething). A solution would be to pass the engine as parameter, e.g`void doSomething(std::mt19937 & engine),but it'll take me some time to modify my doSomething` function,since it's virtual function and therefore, would need to update all the occurrences of it with this new parameter
 
When I go on SO I find that most of the questions are very specific (I haven't looked at the c++ tag much though) and that because I've never had experience with x product combined with y product and them both interoperating with product z and so I find that I can't answer any questions :(
 
Tin
@CatPlusPlus, what would you suggest?
 
6:35 PM
You could make it global, but really shouldn't.
Just refactor.
 
@user1131997 uninitialized value can be anything in release mode and 0xcccccccc only in debug mode in Visual Studio.
 
@CatPlusPlus : The [](int a) { return a + 1; } is a lambda function? I've heard rumors of those.
 
@FaheemMitha Yes.
 
Tin
is it wrong if the engine is initialized locally? is the result of the random uniform distribution no longer valid, if so?
 
@CatPlusPlus : Great. Thanks.
 
6:38 PM
@FaheemMitha Not as readable as C#'s syntax if you ask me, but hey, at least we have lambdas now.
 
@EtiennedeMartel That would be a => a + 1 or something, right?
 
@FredOverflow Yep.
 
beautiful
 
Tin
more specifically, does the local initialization of the std::mt19937 engine hurts a uniform distribution of random generated numbers? as in the doSomething() function in pastebin.com/3gMhEd6r
i did some tests, it seemed that it doesn't hurt, but i'm not sure
 
@Tin Add the static keyword to the declaration, then it will only be initialized once, no matter how often you call the function.
@Tin Also, you don't need the parenthesis in return (EXIT_SUCCESS);.
 
7:00 PM
how can I determinate the size of array (int*) in method , which accepting it

void main(void) { ..... int nums[0xa] = { ... }; A(nums); }

void A(int *buffer) { }

if I use sizeof(buffer) i get 4, it's normal, cause int is 4 bytes

so, How it's better to get size?

- Add to the method seconds argument, which tells the length?
- Or I can in some way get the size of accepted array in method A() ?
 
Use int main, please. I doubt you have a self-hosting implementation.
And you're getting 4 because pointers are 4 bytes on your implementation.
Here's the thing: if the only thing you have is a pointer, then you can't get the size from it. You need to either pass the size with it, or put a special value at the end of the array (that's the technique used by C strings).
 
So true
 
@user1131997 template <typename T, size_t N> size_t array_size(T (&)[N]) { return N; }
that is actually a FAQ (also at @EtiennedeMartel)
 
7:16 PM
@sehe it's from what header? if not using STL/C++, just pure C?
 
OK, read the last two comments and try not to go "WTF?"
2
Q: compiling parts of modules (without headers)

rubenvbThis question is referring to the "Modules in C++" proposals floating around, and more broadly to C like languages that need a similar feature (like my toy language I'm currently... toying with). In my world, "header files" do not exist, forward declarations would be a pest to maintain when writi...

 
@user1131997 It's code. It's not from what header. You usually write that in a text editor for a compiler to compile it :)
 
@sehe if I want to use C++, then I use some containers, as: list, vector etc, which already have size() method
 
@user1131997 Oh sure. I forgot this room is about javascript
 
@sehe the question was about, if you get int* data struct, how shall you get size of it without pre-sending its size from another method
 
7:19 PM
@user1131997 int* is not a "data struct", it's a pointer to int
 
@user1131997 Answer (in C99/C11): you can't. At leat not without undocumented details of your libc implementation
 
@rubenvb please give the determination of "data struct"
 
@sehe I knew about that trick, but it requires an array, not a pointer.
 
@user1131997 you used the term, I quoted it literally. If you don't know what you meant by it, why did you use it?
 
@rubenvb can array or simple single variable be named is data struct, by your opinion?
 
7:22 PM
@user1131997 no. A struct is a struct. A pointer is a pointer.
 
@rubenvb struct is not only keyword
 
@user1131997 A structure is a bunch of variables, essentially.
But they are considered distinct from arrays to avoid confusion.
 
arrays == homogeneous, struct not per se homogeneous.
 
@rubenvb check wiki about definition of variable or array
 
I thought we were talking about C++?
 
7:24 PM
In computer science, an array data structure or simply array is a data structure consisting of a collection of elements (values or variables)
 
Oh, yeah, a "data structure".
 
In computer programming, a variable is a symbolic name given to some known or unknown quantity or information,[dubious – discuss] for the purpose of allowing the name to be used independently of the information it represents.

So, the simple variable also can be named "data structure"
 
Arrays, linked lists, trees, hash tables, those are all data structures.
 
@user1131997 well, for starters, struct != structure, and POINTERS AREN'T ARRAYS in C++!
 
@EtiennedeMartel i have used "data structure" from the begining
 
7:25 PM
@user1131997 and I guess the [dubious] allows me to disagree with wiki on this subject?
 
You said "data struct", so I thought you were refering to a struct.
 
@rubenvb for blindless, reread my first post
 
6 mins ago, by user1131997
@sehe the question was about, if you get int* data struct, how shall you get size of it without pre-sending its size from another method
 
data struct
 
oh, what do you know, this discussion is going nowhere whatsoever
 
7:26 PM
Fuck off.
 
@rubenvb Hey :) I checked and finally decided that porting is not that big of an issue , just using something like http://pastebin.com/Mg1TeZDV
but it always says my file does not exist !
 
and POINTERS AREN'T ARRAYS in C++!
>>>>
int a[2] = { 0, 0xff };
void *b = (void*)a;
void **c = &b;
 
Ohh .. the angry people , when shall they learn :P
 
@angryInsomniac try == instead of !=. I never get those right (although they are correct in my code I linked to earlier).
 
@rubenvb simply , 2 connected pointers by reference can ba named a list
 
7:28 PM
@rubenvb I checked in other places , thats what the condition should be
@rubenvb The stat command can deal with relative paths right ?
 
@angryInsomniac yeah, in my experience, stat works with relative directories
 
@rubenvb Hmm .. wierd !! It should work .. but it doesn't :(
 
@user1131997 Arrays implicitly decay to pointers. But that does not make them pointers.
 
@angryInsomniac remember when I said "fight against OS APIs"? I meant that. I try to copy paste as much of this kind off code as possible, when I find a working example.
@EtiennedeMartel Please don't feed the troll.
 
@EtiennedeMartel what's pointer? a special variable, which points on other?
@rubenvb how old are using keyword "troll", don't you have trollphobia?
 
7:32 PM
@user1131997 Look, an int can be implicitly converted to a double. But that does not mean that int and double are the same thing.
Same thing here.
 
@user1131997 Dude ... ?? Why so hostile to people who were trying to help ya ?
 
let's look at the definition of array

array is a collection , with one type elements, which stores in memory close to each other

if elements are char, for example array begins at 0x100

0x100 - a
0x101 - b
0x101 - c

etc

if int-array:

0x100 - 10
0x104 - 20
0x108 - 2

etc

right?
 
Do you mean in C++ or in general?
 
because the difference between list and array is, that: elements in list can be in memory in different values

and array elements must be close and step in over each other
@EtiennedeMartel I thought, that general definition of array is for all languges, otherwise it's list, tupple or smth another, but not an array, no?
 
@user1131997 Technically, yes (although .NET has a dynamic array class called List, because they like to fuck with us).
 
7:37 PM
@angryInsomniac nice nickname :)
 
@EtiennedeMartel Don't forget Qt's QList, which is really a std::vector+fanciness
 
@rubenvb Yeah, but that's an array of pointers.
 
The language agnostic view of arrays will prefer to speak of 'random-access' rather than base itself on memory, and the CS view will use complexity theory (element access in O(1)).
 
@EtiennedeMartel I think in .net it has only keyword array, really it's a collection
 
@user1131997 Nah, yesterday you succeeded in spelling it correctly, IIRC.
 
7:39 PM
@sehe Thanks :)
 
array is a collection , with one type elements, which stores in memory close to each other

if elements are char, for example array begins at 0x100

0x100 - a
0x101 - b
0x101 - c

etc

if int-array:

0x100 - 10
0x104 - 20
0x108 - 2
 
There are so many things incoherent in those 2 sentences/fragments :
> elements in list can be in memory in different values / and array elements must be close and step in over each other
 
@user1131997 struct { int a, b, c; } - collection , with one type elements, which stores in memory close to each other
 
(had to edit to keep my array contiguous in memory)
@Abyx Not guaranteed to be contiguous, due to padding/alignment rules. Yhet are close, for sure
 
Array elements are aligned also.
 
7:42 PM
@RichardPennington Erm. No? Arrays are aligned. Or clarify your use of the word alignment
 
@sehe there may be gaps between array elements
 
@Abyx Nope.
 
@Abyx No. The structs (if they are) might be padded, though. For primitive types this means the language guarantees: no gaps.
 
sizeof(T[n]) == n*sizeof(T) is a famous identity.
 
yep. IRL, there may be padding between array elements.
 
7:45 PM
Why do people insist on saying stuff uninformedly ...
 
@Abyx But that same padding still exists without the array. It's not intrinsic to arrays.
Nobody is saying 'arrays remove padding'.
 
@Abyx Nope. That would be inside the elements by definition
 
it's wrong identity. In C++ it may be right, but T can have __declspec(align) or similar thing
 
Of course I'm talking about C++.
 
I'm sometimes wrong, but I crawl away in shame if I am. If I have a shred doubt, I'll ask "Isn't it true that an array might add padding between the elements" or "I think with __declspec(align) the behaviour can be modified"
 
Xeo
7:47 PM
Yahoo o/
 
@sehe you're too pedantic to converse with humans? Are you sure you're not a robot?
 
Or you can speak too soon in a casual forum, as I did. :-) I can't think of a machine with a native data type that can form arrays whose elements are not aligned.
 
@Xeo what's up?
 
Xeo
@rubenvb 3 days without internet
 
@rubenvb No - I'm aware of the limits of (my) knowledge
> Note that sizeof(struct Str1) is equal to 32, such that, if an array of Str1 objects is created, and the base of the array is 32-byte aligned, then each member of the array will also be 32-byte aligned. To create an array whose base is properly aligned, use _aligned_malloc, or write your own allocator. .... (etc)
 
7:50 PM
from boost\archive\detail\iserializer.hpp
        // convert integers to correct enum to load
        // determine number of elements in the array. Consider the
        // fact that some machines will align elements on boundries
        // other than characters.
        std::size_t current_count = sizeof(t) / (
            static_cast<char *>(static_cast<void *>(&t[1]))
            - static_cast<char *>(static_cast<void *>(&t[0]))
        );
 
@sehe you sound like you're expecting people to do as you do, and be humble and modest and all.
 
To me that indicates that the padding is inside the struct by definition for __declspec(align) elements
 
@Xeo well, that sucks
Was the weather nice?
 
@rubenvb I'm not expecting. I was going out on a limb, posing the question "Why is it people do not"... - It would preempt so much useless flaming.
@rubenvb You'd just get an exchange of questions, ideas, answers converging to knowledge, instead of people 'positing' their truths and others attacking it
 
@sehe People aren't computers. People have moods, computers have to simulate them.
You're right, but then life would become boring. @DeadMG would not fit in such a world, for one.
 
7:53 PM
@rubenvb I don't get the connection with robots/computer that you seem to make. Are you suggesting that my proposed 'method' of communication is devoid of mood/feeling?
Au contraire, I think it is a sign of sensitiveness that you care about stuff like that. It is because I'm not like a computer. I have preferences :_
@rubenvb I know. I'm not excluding people. All I did is ask a question.
 
@sehe I think that the world would become a dull place, where sarcasm has no place, and some creative forms of humor are not possible. But I may be wrong. I'm not judging you at all. Let's now shut up about this before I start crying because I'm being sensitive for too long :P
 
@rubenvb I didn't intend to rule out sarcasm or humor. I can't see where I implied as much. But then again, you're a human too. So it comes with the game :)
 
@sehe I like taking everything to their extremes without warning, if you hadn't noticed yet.
 
@rubenvb I hadn't. Duly noted. I'm known for the same, BTW. Blind spots anyone :)
 
sbi
Just in case anyone wondered, I flagged @Dzek. I think he overstepped there, and it would do him good to have some time to cool down and think.
 
7:59 PM
@sbi Mmm. Ok, I lent my support to one of those. Saw only two, by the way
 

« first day (491 days earlier)      last day (4443 days later) »