« first day (1133 days earlier)      last day (3832 days later) » 

user3010322
5:00 PM
But I don't know what it's called in english, so I can't give you gusy a link. :c
 
@ScottW there's a lot of deniable there
 
@StackedCrooked whom did you set it up to kill anyways?
 
JBL
 
Xeo
@ThePhD You can also give a link in whatever other language it is in
 
lol
 
user3010322
5:00 PM
@Xeo Managed to find it!
 
The webserver must kill sandbox processes if they timeout. But it was lacking the required permissions to do so.
 
user3010322
 
Although.
What does delete[] do?
 
JBL
@Jeffrey Notice how you can't use int[] to manage dynamic memory.
 
user3010322
@Pawnguy7 It properly destroys something that was new[]'d
 
JBL
5:01 PM
delete;
delete;
...
delete;
 
Bad question.
I meant how.
 
JBL
:D
 
It needs the length.
 
Xeo
implementation detail
 
user3010322
Internally, it's implemented as a wrapper around free mostly.
 
5:02 PM
Also.
 
@JBL those are not of type int[] either but of type int[compiler_plz]
 
How do you tell the difference if a new returns a pointer?
It might be an array, it might not.
 
JBL
@ArneMertz Wat ?
 
user3010322
@Pawnguy7 By what you first write.
 
@Pawnguy7 erm...
 
@JBL Of course not. What operator new returns is a pointer. I understand they are not the same type. I get it. What I don't get is the difference in behavior from an int* and a int[N] as type. int* can be seen as an array of one element and int[N] can be seen as a pointer to the first element of the array.
 
Xeo
@Pawnguy7 FWIW, a single element also counts as an array of size 1
 
I know what new does :\
 
Xeo
But that's irrelevant to delete[]
 
user3010322
apointer = new T(); // Not an array
anarray = new T[ n ]; // An array;
// ...
delete apointer; // You must know what you made
delete[] anarray; // in order to call the proper deleter
 
5:04 PM
@Jefffrey sizeof(int[N]) is N* sizeof(int), while sizoef(int*) is something else :)
 
Xeo
no
 
user3010322
These details are hard to keep track of when a program gets larger, so people write convenient wrappers for you: std::vector, std::array, std::unique_ptr, std::shared_ptr
 
user3010322
In short, never use raw new or raw delete unless there's absolutely NO escape.
 
@ArneMertz You nailed it. That's the kind of differences I wanted to know.
 
Is it like.
Wait, no.
I wonder how you implement the length.
 
Xeo
5:05 PM
You store it somewhere
whereever you want
 
user3010322
It's stored in Shadow Memory.
 
How can the compiler determine how much you allocate though?
 
Xeo
@Pawnguy7 Erm, it knows since you pass it that information?
 
JBL
@Jefffrey That's exactly how to show with code that "one is an array (N element) and one is a pointer (a memory address)".
 
It might vary based on a conditional, for example.
So at the point of delete[]
 
user3010322
5:06 PM
int* f =  new int[ variable ]; // variable gets stored in ... Shadow Memory
 
JBL
I must go, see you !
 
It has a reference to some amount referencing variable ^?
 
WTF is shadow memory?
 
Later
 
user3010322
delete[] f; // Gets 'variable' from Shadow Memory, deletes 'variable' amount of ints
 
Xeo
5:07 PM
@Pawnguy7 The easiest (but no only) way would be to just allocate more than the user asked for, and store the amount somewhere in there.
for example, right before the array.
But that's all implementation detail.
 
67
Q: How does delete[] "know" the size of the operand array?

VolkerKFoo* set = new Foo[100]; // ... delete [] set;You don't pass the array's boundaries to delete[]. But where is that information stored? Is it standardised?

 
user3010322
@Xeo FBX SDK does this.
 
user3010322
With its own manual memory manager
 
That could work. Hrm.
 
user3010322
It even adds a marker byte before the array, so it knows it's "FBX"-allocated memory.
 
user3010322
5:09 PM
@FredOverflow I made it up. It doesn't matter if it was constant read-only Operating-system memory or Shadow Memory or Pink Bubble Gum: it's an implementation detail, and none of your business. :D
 
You can write allocators that don't store the size anywhere.
 
@FredOverflow using this before-array-memory concept, or?
 
Xeo
You can also use some kind of end-marker
 
user3010322
@Xeo Horrible idea. :c
 
@Xeo what, read until you hit the end marker?
 
user3010322
5:12 PM
It's also not very secure. If your end marker was a sequence of bytes "0xC1CADA", all someone has to do is insert that sequence in their array and you're fucked.
 
user3010322
It also means you need to scan the whole memory block to find the end of that block, which is a ridiculous idea.
 
Are we talking about accidental, or intentional?
 
user3010322
@Pawnguy7 Either.
 
Accidental could be a problem. I wonder, though. Couldn't you also read before the start of the array?
 
user3010322
That's what most implementations do now. Create a head block somewhere.
 
5:13 PM
So much cock in unexpected places these days.
 
Well yes, that makes sense.
But how is it made.. tamperproof?
 
@Pawnguy7 (1) it isn't
 
user3010322
Shrug. It's not? Once you figure out where it is, you can fuck it over.
 
user3010322
That goes with anything in programming.
 
user3010322
If you can find the bits, you can fuck them over.
 
5:14 PM
@Pawnguy7 (2) MSVC has "<length><magic number><your data><magic number>". Then it can check the magic numbers and affirm you probably haven't written outside your area.
 
Xeo
There are implementations that include some protection bits around the head, to see if you accidentally overwrote it
 
user3010322
The problem becomes: where are the bits you can fuck over, and how do you fuck them over?
 
@ThePhD Pedophile!
 
I figured since you listed it as a reason for the other one, that the same flaw didn't exist in the first.
 
@ThePhD usually 4-16 bytes before the pointer returned
MSVC's is quite well documented
 
5:15 PM
@ThePhD Why do you want to fuck the bits?
 
user3010322
Because they're just too adorable.
 
Xeo
@Pawnguy7 You have to try and fuck up the head-before-pointer one, while you can accidentally fuck up the marker-after-end one
 
> Muons, for example, only live about 10-6 seconds, but they're moving so fast that time dilation means they live longer from the Earth's frame of reference.
 
Xeo
By simply having the same value in there
 
fuck you quantum physics!
 
user1804599
5:18 PM
Ugh.
 
user1804599
Fucking Greenpeace.
 
@Xeo good point
 
@TonyTheLion, be constructive or keep quiet. You've commented on everyone else's post but offered nothing to help. — Rob EatsEverything Delaney 43 secs ago
 
Flag it as WUDE
 
ugh
fucking OP
 
5:21 PM
I was wondering once.
How to delimit a sequence of bytes.
When any of them can be values.
 
Don't?
 
heh
then you can't really delimit them
can you now?
 
I guess not.
 
Sure you can
 
user3010322
@Pawnguy7 This is the fundamental problem with the null terminator on strings and Unicode.
 
user1804599
5:22 PM
@TonyTheLion just butthurt because downvotes.
 
But don't
 
user1804599
Downvote, close and ignore.
 
@rightfold yerp
 
user3010322
Unicode has a valid character NUL '\0', but every c-string uses NUL to determine the end of a string.
 
user3010322
This is why counted strings are vastly superior.
 
user1804599
5:22 PM
@Pawnguy7 Just prefix the sequence with an integer representing the length of the sequence.
 
Could work.
For some reason I had the idea, if you slipped up, you couldn't recover, but I don't know how you would.
 
@ThePhD I think for c-strings it makes sense - not sure how else you would do it. I don't know how it could ever be considered a valid character for a string to have, though.
 
user3010322
@Pawnguy7 The reason people made null-terminated strings is because C programmers back in the day had a real issue with returning structs by value.
 
getting slightly mad with waiting for boost to compile these days
 
user3010322
5:25 PM
People wanted to return what they thought were strings (const char*) but couldn't also return the length
 
I mean, what's with that. Taking soooo much longer than on linux.
 
user1804599
Don’t compile Boost.
 
hahaha
 
user1804599
$ brew install boost
 
I need it, sadly.
 
user1804599
5:25 PM
Takes three seconds.
 
@ThePhD can't you pass a pointer to the struct?
 
Yeah, you know, on linux, building it is <10 minutes
 
Xeo
@ThePhD Uh, Pascal strings don't need null termination. You could just, like before, store the length before the string.
And have some function to access it
 
user3010322
> C programmers
 
 
Xeo
5:26 PM
@ThePhD They're just called "Pascal strings"
They could've been used just the same in C
 
Right now, I've been looking at this graph far too long. This PC is a powerhouse (32Gb, SSD, Xeon@3.4)
 
user3010322
@Xeo But... but integer copies and pointer copies when returning the string structure! q__q
 
Pascal specifically used only one byte for size
 
And only, because last time I waited F O R E V E R --buildtype=complete turned out to be so complete that it doesn't, in fact, build the 64bit binaries on my 64bit toolchain.
 
@ThePhD What
 
5:27 PM
So, building those right now
 
user3010322
@CatPlusPlus I'm making fun of C programmers.
 
user1804599
@sehe build it from a RAM disk.
 
Hahahaha. I do, at home. And when under linux
 
user1804599
Parallel?
 
What?!
 
user1804599
5:30 PM
Oh right, Windows.
 
user3010322
Nani?!
 
Yup
@work right now
 
user1804599
Do a parallel build anyway.
 
Oh.
I had a funny error with SFML once.
 
user1804599
You can build multiple libraries at once.
 
5:31 PM
So I was using TCP.
 
It's parallel. I think you can see from the graph
Stop.
Trolling
 
user1804599
Do I know what else you are doing. vOv
 
You pass it a character buffer, and give it the length of the buffer.
My length was longer than the buffer, though.
 
lol. I'm trying to use VS as well, yes. Not working too well :/
Anyways, it's done now
 
user1804599
And Opera.
 
5:32 PM
Want to guess what it ended up sending?
 
Nope. Opera on Win8 sucks. I burninated it
 
isn't opera just chrome anymore?
 
user1804599
I’m going to write a bug tracker in Scala.
 
Nobody wants to hear my story? :\
 
@Mgetz no. it's using the same rendering engine. meh. That just means it looks the same and has roughly comparable performance. All other things are different.
But you knew that
 
5:37 PM
aye, but usually the chrome doesn't affect actual rendering. I suppose I'm thinking too much from a developer perspective as I've been doing HTML/JS a lot lately
 
smurf is the word
 
buh buh buh buh buh buh buh bird is the word!
 
Every browser should just switch to webkit
 
@Rapptz connect.microsoft.com/VisualStudio/feedback/details/730005/… someone already did, closed as by design. Apperently the debug heap is ~90% of that slowdown O.o Running with VS not attached results in it running in 10% of the time.
test searching for (CXP-\d{4,5})
generating random text...  dur:598
strstr + isdigit              : nocheat=2557551 dur:15
CXP-\d\d\d\d\d?               : nocheat=2557551 dur:757
CXP-\d{4,5}                   : nocheat=2557551 dur:739
CXP-\d\d\d\d\d? (optimized)   : nocheat=2557551 dur:757
CXP-\d{4,5}(optimized)        : nocheat=2557551 dur:723
 
5:49 PM
Why would anyone measure performance under debugger :psyduck:
 
If you have an array 4 chars. And for each character there is a thread which reads and writes to it. How is this made thread-safe at the lower level on a machine which has a 32-bit instruction set?
 
user1804599
It isn’t.
 
It's slow due to false sharing. But I don't think it's incorrect.
 
user1804599
You need atomicity.
 
Each thread reads and writes the same thing?
 
5:51 PM
@CatPlusPlus I didn't realize having a debugger attached would incur that much penalty
 
Yes, there is a dedicated thread for each character.
 
@MooingDuck I'd think it's kind of obvious
@StackedCrooked Then why would it be thread unsafe?
There is no difference between an array of 4 bytes and 4 byte-sized variables
 
@CatPlusPlus what would the debugger be doing that would cause a penalty?
 
It's different memory locations
@MooingDuck Anything
 
Can the CPU write a single byte to memory?
 
5:52 PM
why would it be doing anything at all?
 
user1804599
@CatPlusPlus alignment.
 
@rightfold Maybe
 
Assuming the array is aligned on 4-byte boundary.
 
@MooingDuck It already instruments the code to be a debugger, why wouldn't it do things to make debugging easier?
 
user1804599
@StackedCrooked The bytes themselves still aren’t.
 
user1804599
5:53 PM
Arrays are always packed.
 
The first byte will be aligned on 4-byte boundary.
 
user1804599
I want to make software.
 
Debugger can suspend your threads at any time
 
My question may be the product of bad understanding of CPU.
 
@rightfold Tell me when you reach bootstrap.
 
user1804599
5:57 PM
See you never!
 
If I increment an uint8_t in C++ and the CPU only has 32-bit instruction set then I assume the CPU will read the word, apply a transformation (bitmask?) to get the value of the relevant byte as a word, increment the word, write the word back to its original location using a transformation to preserve the other 3 bytes.
hey, that would be thread-safe anyway.
 

« first day (1133 days earlier)      last day (3832 days later) »