« first day (476 days earlier)      last day (4477 days later) » 

sbi
6:00 PM
@Abyx You can use the standard library without using pointers to arrays. I know, I've been doing it for more than 10 years.
 
I mean that some libraries use pointers to array in its implementations
 
@Abyx Like what?
 
e.g. C++ version of countof uses pointer to array as return value
template<typename T, size_t N>
char (*countof_helper(T(&)[N]))[N];

#define countof(x) sizeof(*countof_helper(x))
something like that
 
user784668
@Abyx std::array::size
 
sbi
@Abyx Yeah, I have seen those before. You don't need them for using the std lib, though.
 
6:05 PM
@Fanael it's not the countof.
 
user784668
@Abyx You don't need countof if you use std::array.
 
@sbi but std lib can have it somewhere in its implementation.
 
sbi
@Abyx What he means is that you need countof because you are fiddling with C-style arrays, where you should use std::array.
 
user784668
Oh, and std::array::size is constexpr, so you can use it wherever you need a compile-time constant, too.
 
sbi
@Abyx It could. I don't know if C++11 introduced it. But even if it does — the std lib uses a lot of stuff under the hood most of us never use.
 
6:07 PM
well, with C++11 I probably will replace all T[] to std::array, but my compiler still don't support C++11
 
sbi
@Abyx boost::array
 
user784668
@Abyx The standard library implementation consists of dragons. Fortunately, they're all hidden behind a portable interface, so we don't have to cope with them.
 
@sbi boost can't add constexpr and initializer lists
 
user784668
@Abyx It doesn't need initializer lists.
 
sbi
Anyway, I need to go and buy some food for the weekend, lest I'll be starving. I'll probably back in an hour or two. See you guys!
 
6:17 PM
btw, C++ has std::identity, so, instead of T(*)[N], we can write std::identity<T[N]>::type*, like in C#
... but because of crappy nature of C++, IRL it will be typename std::identity<T[N]>::type* (maybe I forgot yet another typename somewhere)
 
6:46 PM
haha, no
it will be std::identity<T[N]>, thanks to template alias
 
@DeadMG say it to VC++
 
also, it would only have a typename if T was a dependent type
@Abyx VC++ is not C++11
 
VC++11 too =(
 
@DeadMG Do you know of any decent rundown of C++11 features supported by the different VS compilers?
 
the general grid includes Visual Studio
 
6:51 PM
@Abyx VC++11 isn't as well.
 
@DeadMG general grid? I found blogs.msdn.com/b/vcblog/archive/2011/09/12/10209291.aspx which seems to disappoint my expectations.
 
is it possible to disasseble a function if I know it's address? i.e by having it's function pointer?
 
no
 
why?
then what does the pointer point to in case of a function pointer?
 
6:55 PM
Morning.
 
who knows?
 
I thought someone here would know
 
well, you have absolutely no way of knowing how large the function is
 
@KarimA yep, it's possible
you need a disassembler for it
 
Obviously.
 
6:58 PM
Abyx, this is what I though - now my next question would be: given a pointer to a function, how could I know how large is it? is there a way to figure out how much memory does that function's code occupy?
DeadMG, even if I had total control over the source code? and declared something right after that function and used that address as the "end"?
does the compiler reorder functions?
 
the compiler can do whatever the hell it wants
 
@KarimA in common case, you can't get its end. But for some compilers you can try to find last ret
 
or maybe by looking at "ret" assembly instruction?
yeah - but that leads to another question: what if a function returns in several places?
 
you can't guarantee that any given ret is the last ret
 
usually it's not enough to find "ret", function can have SEH handlers after it
 
7:00 PM
okey - then maybe let me put you a bit in the context:
 
oh, and another thing
 
anyway, there is a code for finding function length for delphi. maybe it works only because of delphi compiler %)
 
I have a highly concurrent source code that has some data-race conditions in it. It has unit tests written that pass, but I can spot a couple of places where it could have a potential data race.
 
just because you have a function pointer doesn't mean the compiler didn't inline it into other call sites
 
omg
 
7:02 PM
so what I'm trying to do, is to get a pointer to the test function, get it's assebly instructions and execute them in a specific order that would reliably fail in case of a data race
 
oh...
 
that's utterly insane
you would need a virtual machine
 
do you know programming at assembly level or RCE?
 
a sort of a debugger, that would try to find any interleaving writes to a global variable (any location that lies outside of function's memroy region) and reorder the instructions accordingly
 
it's impossible.
 
7:03 PM
you have a bigger problem
 
Abyx, more or less, but I can learn it for the purpose if this task
 
you would need to use a VM to even get remotely close to that level of control
 
DeadMG - a virtual machine - I thought about it.
 
and more importantly, there are n^y possible interleavings of instructions for n instructions for y concurrent threads
that's way too many to check
 
yes - but you can apply some heuristics to that
and instead if checking it by brute-force, use them to exploit the 80% most common cases
 
7:05 PM
you won't find jack squat in terms of data races in those cases
 
Well, if I'll build this virtual machine - I think I'll be halfway through :)
I've looked at Microsoft CHESS
it's built around a similar concept
 
it would be very difficult to construct such a machine
 
difficult =/= impossible
 
it's impossible in your case.
 
but possible != efficient expenditure of time
 
7:07 PM
Abyx, why?
 
I found a bug in this chat :)
 
Xeo
Damn, I want Chandler's talk to be uploaded ... and the final Q&A panel. :/
 
I think I need first to try to experiment with this concept. The first thing I will try is given a pointer to a function (and any other information about a function I might need), try to disassemble it, write it's disassembly to a file, then assemble it back and execute it.
 
it would be better to simply eliminate the data races to begin with
 
This would prove that my idea is doable
 
7:11 PM
you won't be able to disassemble it
 
DeadMG - here we have a different problem. Building a concurrency-test tool
 
who said anything about testing?
you should be able to trivially know every piece of data all your threads depend on
 
@KarimA why can't you compile that code with assembly output?
 
Abyx, what's the compiler flag fir this?
in VC?
*for
 
/Fa
but you can't compile that output
 
7:13 PM
I understand. But given the assembly + debug symbols...
I will know what code is behind a certain function
 
well.. you can spend some days to understand that it's impossible
btw, try the following code:
..one line of code ...
if (rand() % 2 = 0) SwitchToThead();
..one next line of code ...
it will shuffle threads execution so you can catch something
 
Abyx, my idea is different.
What I'm trying to to is something like this:

test.add_fn(concurrentwrites1)
test.add_fn(concurrentwrites2)

test.assert(result = x);
then, each function passed to add_fn would be broken into instructions
and I would simply build a deterministic scheduler that would switch contexts between all the functions
in the most dangerous pattern
so the concurrentwrites[1,2] will not have any explicit threading control
 
you can insert context switching directly into (source) code
 
this would be usefull for testing for example lockless data structures
 
well... you can try to single-step assembly instruction
 
7:20 PM
and see if
test.add_fn(linked_list_inserts1);
test.add_fn(linked_list_inserts2);

test.assert(linked_list_count_is_ok);
test.assert(linked_list_is_not_missing_any_element);
yes - this is what I'm thinking about
executing a single instruction at a time
of course it would hide some other problems like instruction reordering
but if I have control over the instruction execution order, I can simulate that as well
 
then you don't need disassembler at all, just set TF flag in thread context
 
can you give me a link or keywords to read more about the TF flags in thread context?
 
or, you can use length disassembler and set breakpoint on every instruction
SetThreadContext
also read something on creating a debugger
 
ok - I will try today to write such a debugger for .NET, as it's a bit easier to decode msil code than x86 asm. Then after proving that the concept is valid I will try with native code.
 
@KarimA .NET don't executes msil, it compiles it to same x86
 
7:33 PM
clr
 
but you can disassemble msil, modify and compile back to msil
 
Not entirely, because if I'll modify the msil, these is a chance that the opcodes i will inject, will have effect on the evaluation stack
which will alter the original program's behavior
 
nah
you can prove that msil is pure relatively easly
each instruction is like, push one, pop two, such
 
8:06 PM
include/c++/4.6.2/bits/fstream.tcc:87: undefined reference to 'std::__basic_file<char>::__basic_file(pthread_mutex_t_**)'
Fun with MinGW continues.
 
Non stop fun.
 
Those silly anon.
 
you're late
that was breaking news a whole 24 hours ago
or maybe 36
 
sbi
@DeadMG Weren't you still wearing diapers back then?
 
24 hours ago? I don't think so
 
sbi
8:34 PM
@DeadMG or maybe 36?
 
evening all
 
evening
 
what's new?
except the operator
which isn't new
 
new is an old operator
 
8:47 PM
lulz
I watched Bjarne's keynote today, good talk
 
sbi
 
what's that?
 
sbi
What's this?
lol
 
Snow under a microscope?
 
sbi
8:48 PM
Yep, it's a snowflake.
@Emil You might have noticed that this is the C++ room. Welcome. And please read the newbie hints.
Meanwhile, I put that message where it belongs: in the bin.
 
@sbi I know, but there isn't anyone in the iPhone/Obj-C-room..
 
sbi
1 message moved to bin
 
The OP is free to accept his answer of choice. Doesn't need to be the best answer.
 
don't think anyone knows objective c here
 
I know that, but the answer is outright wrong.
 
8:51 PM
I have programmed in Objective-C. I don't have much knowledge about it though.
 
sbi
Finally, an ad blocker that works with any browser:
 
That person keeps the monitor close to his eyes.
 
would you consider C a prerequisite to C++?
 
sbi
@JohnMerlino No, definitely not. To the contrary — when you learn C first, you will have to unlearn a lot of the stuff in order to learn to write good C++.
 
8:59 PM
@JohnMerlino No.
 
can you use C++ as an alternative to C, or are there times where C is required.
 
Some obscure cases.
 
sbi
74
A: When to use C over C++, and C++ over C?

sbiYou pick C when you need portable assembler (which is what C is, really) for whatever reason, your platform doesn't provide C++ (a C compiler is much easier to implement), you need to interact with other languages that can only interact with C (usually the lowest common denominator on any pl...

 
Like platforms that have no available C++ compilers.
 
thanks for response
 
9:00 PM
Otherwise, not really.
 
RAAAGE QUIT
 
sbi
@EtiennedeMartel Are you Ok? Sheepish look.
 
I'm playing Battlefield 3
 
sbi
Oh, war.
Digs.
Ah, here:
Man: the meat that goes meta.
 
Damn it, if you're going to drive a tank, make sure you know how to drive one.
 
sbi
9:09 PM
I couldn't agree more, at least not based on this evidence.
Mhmm. Interesting guy, that.
Design pattern overuse is the programming version of the common aesthetic-imitation/role-playing failure mode. http://news.ycombinator.com/item?id=2793998
Wut?
 
@sbi it means "I know some magic words that noone understands"
 
sbi
@Abyx Yeah, that seems fitting.
 
> I sometimes wonder what would have happened to the software industry if the entries in GoF had been written in a different order. Would we see a plague of Visitors and Observers?
That's a frightening perspective.
 
9:31 PM
Fuck SVN
I have to upload 50 MB of stuff.
Well, guess what? My working copy was outdated, and I had to update it. But SVN decided to tell me that after I attempted to upload 50 MB of stuff.
 
sbi
@EtiennedeMartel ...while playing Battlefield 3?
 
is it me or is Dekker's algorithm for mutual exclusion confusing
 
@sbi Nah, I stopped playing 10 minutes ago.
Too many noobs.
(just kidding)
But honestly sometimes I play BF3 while coding. Or at least while compiling.
 
sbi
<insert XKCD sword fighting strip>
 
is BF3 good?
 
9:36 PM
Best FPS on the market, as of now.
If you like shooters, you'll enjoy BF3.
 
oh cool
 
The multiplayer, at least.
The single player campaign sucks.
 
oh right
well, the day I can afford the cost of the game, I may consider
 
According to Battelog (BF3's pseudo-social network), I spent 91h36m playing the game.
 
10:07 PM
-1
A: Can I functionally concatenate a number and string?

Stevewhy not pure string foo(immutable int bar) { newbit = to!string(bar); return "Number: " ~ newbit; } I actually don't even know what language this is, but that would be the basis of doing it I think.

Erm...
 
> I'm just going for the record number of down votes. Apparently there is a new badge.
 
Yeah. I flagged the answer.
 
@EtiennedeMartel I noticed a tendency that I tend to play a game at most 200h. Of course that's not for all games, but so far the multiplayer games that I've been playing (ever since Steam displays total time played) most hover near that value.
 
@LucDanton That's about the time I spent playing StarCraft 2.
 
user142019
stackoverflow.com/questions/9144788/… "I'm just going for the record number of down votes. Apparently there is a new badge."
 
user142019
10:12 PM
T_T
 
@EtiennedeMartel Oh, there's total time for that one? I need to check then.
 
Yeah.
@LucDanton No, there isn't. It's just a rough estimate based on my game count.
 
@EtiennedeMartel What do you clock the average game at?
 
15 minutes.
Actually, no, more like 20.
 
Mmmh, I assume that's a figure for 1v1, which I haven't played at all.
 
10:22 PM
This source file is 3,585 lines long....
 
Xeo
Phew, finally finished rewatching the Clang talk and the final Q&A Panel from GN.
 
Does "scheduled for deprecation in January of 2012" mean that it was marked deprecated in January, or that it was supposed to be removed in January?
 
Xeo
10:38 PM
That it was supposed to be deprected in January?
 
I parse it that way as well.
 
Anyone where experienced with digital logic terms?
 
@EtiennedeMartel I would help him but I don't want to lose 1 rep
 
sbi
@EtiennedeMartel I just voted for deletion.
 
It's deleted then, I just did too
Oh, I guess maxpm didn't vote to delete
still need 1
 
sbi
10:44 PM
@SethCarnegie No, it isn't. It takes more votes.
 
Yeah, I thought there were two before me but there was just one
 
Xeo
Purged.
 
Anyone here knows digital logic?
 
sbi
What is "digital logic"?
 
user142019
Probably something with logic gates (AND, OR, XOR, NOR, NOT, …) and digital signals.
 
user142019
10:54 PM
@LearningC Or did you mean something else?
 
sbi
@WTP Well, you can't have logic gates with analogue signals, can you?
 
@WTP That is what i mean
It about octal and binary numbers and something like that
1
Q: Please help me understand what this is asking

Learning CThis question is from my digital logic class but I don't understand it. Please help me understand what it is asking me. Lets say A1 and A2 are octal shorthand. Perform the following 1's complement fixed-point integer arithmetic operations and note whether magnitude overflow has occurred in e...

 
user142019
Have you checked out electronics.stackexchange.com (may be more helpful but I'm not sure)?
 
@LearningC read a textbook
 
@Abyx I've tried. It is bad enough I don't understand English, now they throw in these complex terms I get lost in what they are trying to say.
@WTP thank you very much didn't know they had one for electronics. Going to make an account there right now.
 
11:01 PM
then learn english... I don't understand English too, but write something here.
 
@LearningC what don't you understand?
 
@LearningC I have master degree at microcomputing engineering
What do you need?
 
but quick, I am in a good mood.
ping me when you come back, I need a work to do.
 
user142019
Does anybody know what the used endianness is on ideone?
 
11:15 PM
Hi room
wow :/ hey does anybody know where I can get RSTP for youtube video at? or how to get it?
 
The what?
 
@WTP apparently little-endian
 
Probably runs on x86.
 
@EtiennedeMartel have you seen wimp.com/dividedbrain
 
Nope, I didn't.
 
11:21 PM
It's an amazing video, not to mention the guy speaking sounds like Matt Smith
I just remembered it because of the RSA video you linked
 
@SethCarnegie You're right, he sounds a bit like Matt Smith.
 
Is it weird to accept an answer and then edit it?
 
Hell, he even says "time and space".
It's uncanny.
 
It's fascinating.
 
sbi
11:30 PM
So what would I use to watch flv movies (I think that's Flash's format) on a Win7 PC?
 
VLC.
 
Actually, anytime you want to watch a movie, use VLC.
 
sbi
@LucDanton Oh, it can do that, too?
 
It can do anything.
 
Yep, anything. You can even watch a live stream in VLC instead of the browser + Flash.
 
sbi
11:32 PM
I used to use VLC about >10 years ago, but it was still pretty bad back then, so I switched away from it and never tried it again. I suppose it's much better now.
 
Yeah, I used it for GoingNative.
 
You can program VLC to record a media stream, too.
 
sbi
Well, at least it's got passed 1.0 meanwhile.
 
On another note, I think one of the popular alternative to VLC is Media Player Classic Home Theater or something, which shouldn't be confused with the original Media Player Classic (which has been orphaned).
Other than that, the Windows Media Player has its users I think.
 
Xeo
@LucDanton MPC HC (Media Player Classic Home Cinema)
You were close. :)
 
11:49 PM
is there any function that is similar to malloc() except that it doesn't invoke handling?
I need it quick.
 
Handling what? What about new wrapped through make_unique?
 
I don't want new handlers to be called in the code.
 
that makes sense, yes :)
I am dealing with actual allocation right now @EtiennedeMartel
 
Can you give even less details?
 
11:53 PM
What handlers?
 
I need to get some memory block from the heap
 
@LucDanton This morning, VLC made my toast. Buttered it too.
 
@CaptainGiraffe Now that's something.
 
and the thing is that that heap is quite messy, so I need to exclude actual allocation
 
Still doesn't make coffee, though.
 
11:56 PM
so can my app work neatly.
 
@DzekTrek Well, just use a new char[SIZE] or something.
 
@EtiennedeMartel I submitted that as a bug.
 
You want allocation without 'actual allocation'. Okay. I'm going to carry on my business I think.
 
Yeah, I'm confused too.
 
@EtiennedeMartel I have changed the size of the heap, but it is so big it now locks some other functionalities :(
this is going like in forever
 
11:58 PM
You still don't make any sense.
It's like you don't know what "heap" means.
 
Now I have problem with LeaveCriticalSection.
sorry it was my fast writing, I ment to say allocated memory blocks
 
There's simply no other portable allocation primitives than malloc, new and friends (operator new etc). If none of those satisfies your requirements, whatever they are, switch to something specific to your platform. Or explain yourself better (perhaps a memory arena + custom allocator would fit your problem, but what do I know).
 

« first day (476 days earlier)      last day (4477 days later) »