« first day (565 days earlier)      last day (4384 days later) » 

9:00 PM
Barnes and Nobe is run by idiots. They pulled a Linux magazine of the shelves because of article titled "Learn to Hack" http://bit.ly/Iu2vUX
 
@MooingDuck thanks dude
 
C++ tools can be so amazingly annoying.
 
@MooingDuck Thanks, I'll have a look later.
 
@RMartinhoFernandes you have no obligation to look at it ever, we're on the internet :P
 
9:10 PM
erm... is super::super(int val) is not public, can derived::derived(int val): super(val) work?
 
Yes.
If super::super is protected.
 
sigh, std::random_shuffle is a fail at what it does. even w/ question answered and it working, it doesn't write values correctly.
 
@stdOrgnlDave I use it all the time and it works great, what's the fail?
 
someone answered to just feed the raw pointers as iterators
so I do pstr+10, pstr+num_elements - 10
 
9:12 PM
@RMartinhoFernandes ideone.com/qOyaI
 
however, pstr[0] gets shuffled in somehow
 
just sent this to usenet xD
 
I know because pstr[0] points to an int '4' and it segfaults trying to access location 0x0000004
 
and if class foo defines class bar a friend, all classes that inherit foo also have bar as a friend right?
 
Ell
can anyone reccomend a band if i like sting, the police, gotye, phil collins, muse, radiohead ...? any bands similar to any of those?
 
9:13 PM
@JohannesSchaublitb new int[0] doesn't create any objects!
 
@RMartinhoFernandes lulz
 
@Ell <troll mode activated> cannibal corpse <troll mode deactivated>
 
@JohannesSchaublitb Is that a "yes"?
 
@RMartinhoFernandes it creates a temporary pointer (or zero-sized array? Whatever.)
 
@RMartinhoFernandes wait, you are serious?
why would it not create an object?
the spec says it creates an object of type int[0]
 
Ell
9:14 PM
@thecoshman ....wow....
 
@JohannesSchaublitb Because it would remove any contradiction :P
 
@Ell :D
 
what can you do with an int[0]?
 
@RMartinhoFernandes hmm this formulation in the spec looks interesting "1 The delete-expression operator destroys a most derived object (1.8) or array created by a new-expression."
 
Nothing.
 
9:17 PM
@JohannesSchaublitb It only says it sends a request to the allocator to allocate zero bytes, it says.
 
@stdOrgnlDave std::random_shuffle works fine, and does not dereference pointers, so what any of them point at is irrelevant, especially if it's not even in the range. Your problem is elsewhere. Again.
 
wow... 14 upvotes on that inheritance question already and no good answers...
If I can only repro this damn thing on one of my machines...
 
@stdOrgnlDave wait, "'auto' differs in levels of indirection from 'int *'"? Did you not compile in C++11 mode?
 
@Mysticial Is the assembly listed anywhere?
 
@GManNickG it says that "The new-expression attempts to create an object of the type-id (8.1) or new-type-id to which it is applied.
The type of that object is the allocated type."
 
9:19 PM
@MooingDuck of course I did.
 
"Entities created by a new-expression have dynamic storage duration (3.7.4)."
 
@GManNickG nope
 
and an array i an object
 
@stdOrgnlDave I highly doubt a C++11 compiler would produce that error message
 
and only objects have storage duration
well, and references but they cannot be created by "new"
 
9:20 PM
do I have to put friend class foo some where special in my class? I can't work out why the friended class is not able to call these functions
 
you just say
friend class A;
in your class B
 
@thecoshman anywhere is fine.
 
@FredOverflow alias kthxbye="gnome-session-save --force-logout"
 
and it is inherited isn't it?
 
@GManNickG i hope it will become a heated question on usenet!
 
9:21 PM
friendship is file (namespace?)-scoped and not inherited.
 
C++ has no "file scope"
 
Yeah whatever. :P
 
You can't inherit friend class.
But you can define it in inherited ofc.
 
@thecoshman are templates involved?
 
> When the value of the expression in a noptr-new-declarator is zero, the allocation function is called to allocate an array with no elements.
What of this?
 
9:22 PM
@MooingDuck to whatever degree you count VC10 a C++11 compiler, it most certainly does
 
Isn't the wording here extremely, well, contradicting?
What's an array with no elements?
 
@JohannesSchaublitb Ah, I see what you mean. Me too!
 
could it be a namespace thing? the class I want to declare friendship in and the one I want to friend to are both in the same namespace? would I have to add this name space to the friend deceleration?
 
An empty array.
 
@RMartinhoFernandes it is an empty array mwahaha
c++ does not deny such arrays
it only says in a nonnormative footnote that c++ does not have zero length arrays
but footnotes are crap anyway
 
9:24 PM
@JohannesSchaublitb Is that valid? Can I get a section number and paragraph? (Not that I don't trust you, but I'd like to read that)
 
@stdOrgnlDave I copied the code from your question into MSVC10. CNR. We can't help without a SSCCE.
 
on what do you wanna have a section number and paragraph?
 
I'd just stay away from them when possible.
 
types are never really explained in detail. only the ways they can be specified are
 
@GManNickG I managed to reproduce it on my Xeon machine... Time to look at assembly...
 
9:25 PM
the extent to what types exist are mostly implicitly set by the way they can be denoted/specified
 
@RMartinhoFernandes I remember reading a "bug" report about std::vector when allocating arrays of 0 length at one point for GCC. They changed it to not allocate anything at all in that case.
 
@Mysticial Good, I'm curious!
 
Can a T[0] decay to a T*?
 
Obviously.
 
the new operator just extends that frame to zero sized arrays. clause 8 that elaborates on "type-id" only allows to denote arrays starting with size 1
so "new (int[0])" is ill-formed because it uses a type-id instead of a new-type-id
 
9:26 PM
Array names decay.
 
libc++ implements new with size 0 just as mallocing one byte…
 
@MooingDuck problem is solved man
 
For the curious: ideone.com/JHKjk
 
gcc extension
 
@classdaknok_t but 1 != 0
 
9:28 PM
i personally added code to clang to reject "new (int[0])" xD
 
GCC is one big language extension.
 
what are they smoking
 
Downloading files makes my laptop freeze randomly for some reason. :.
 
@thecoshman new is allowed to allocate extra space
 
@JohannesSchaublitb Was thinking so, thanks.
 
9:29 PM
@thecoshman how would you implement it? I don't know what malloc(0) does, but probably not what anyone would expect (since it's a C function).
 
Again? "You attempted to reach ideone.com, but the server presented an expired certificate. No information is available to indicate whether that certificate has been compromised since its expiration. This means Google Chrome cannot guarantee that you are communicating with ideone.com and not an attacker. You should not proceed."
@classdaknok_t return null; They can't dereference the pointer anyway.
 
@MooingDuck Again, obviously. The expired certificate didn't re-validate itself.
 
Who cares about expired certificates?
 
@classdaknok_t I do.
 
9:31 PM
throw an error. it makes no sense
 
when doing "new (int[0])" GCC complains about VLAs xD
 
@stdOrgnlDave can you edit the auto addendum out of the question? It looks like an unsolved question.
 
not sure whether they fixed that
 
I wish Boost had something like ncurses. :(
 
@thecoshman "What were you doing, throwing and erroring all night?"
 
9:31 PM
@thecoshman it's valid input, it shouldn't throw an error. returning null would make vector much easier to implement, and slightly faster probably
 
@thecoshman you have to implement the standard. If the standard guarantees that new T[0] either returns a valid pointer or throws std::bad_alloc, you shouldn't throw std::invalid_argument.
 
@thecoshman int main() { throw "an error"; } is valid code. It should throw an error
Aha, I missed the context
 
@MooingDuck Can't return NULL.
That's what it returns on error.
 
@RMartinhoFernandes operator new does? Or just the nothrow?
 
@MooingDuck malloc.
 
9:33 PM
Ah, the nothrow version would be interesting. You'd have to return some other "magic" pointer
 
And the nothrow operator too.
 
@RMartinhoFernandes pft, malloc's rules don't apply here (in theory) :D
 
@sehe It's UB isn't it?
 
@GManNickG yes
 
@GManNickG Yes, it's UB to allow an exception to escape from main.
 
9:34 PM
@MooingDuck They do apply because you were replying to a message about malloc(0).
 
@GManNickG I thought the standard library would cause std::terminate to be called
 
4 mins ago, by class daknok_t
@thecoshman how would you implement it? I don't know what malloc(0) does, but probably not what anyone would expect (since it's a C function).
 
@DeadMG wait. does it not just call terminate?
 
@JohannesSchaublitb That's what I remembered
 
@RMartinhoFernandes oh, so I did. I missed that. My bad.
 
9:35 PM
Oh, it does just call std::terminate(). §15.3/9.
 
@JohannesSchaublitb AFAIK, it's UB. terminate is for violating exception specifications.
 
unexpected, too.
 
terminate is also called for throwing during unwind.
 
(9 not 10, sorry.)
 
> The malloc() function allocates size bytes and returns a pointer to the allocated memory. The memory is not initialized. If size is 0, then malloc() returns either NULL, or a unique pointer value that can later be successfully passed to free().
 
9:36 PM
Man, this is definitely not my week.
 
> § 15.3 ad 9: If no matching handler is found, the function std::terminate() is called; whether or not the stack is unwound before this call to std::terminate() is implementation-defined (15.5.1).
 
Beat ya. :P
 
> § 15.5.1 ad 1, bullet 2: when the exception handling mechanism cannot find a handler for a thrown exception
 
> Test. So quoting works the same, cool.
 
9:38 PM
@GManNickG Who said that?
;)
 
@GManNickG > Only it doesn't work in replies
 
OK running 1k iterations on 2gigs of pointers
 
@sehe Ah, see that's why I thought it didn't work in chat, then I see you guys do it once in a while and get confused. Just can't reply at the same time!
 
this'll take forever
 
How do I get the address of a non-static function?
 
9:39 PM
&class::function
 
@stdOrgnlDave source link? I can burn some kilowatts
 
And now, get baffled when it works! — R. Martinho Fernandes 10 secs ago
Sort of.
 
@stdOrgnlDave thx
 
@RMartinhoFernandes abusing comment onebox
I know because you were baffled when I did that
 
9:41 PM
@sehe codepad.org/zjR9z37c gotta compile 64-bit or turn the size of the array down
 
For the record, I'd like to indicate that I think 'buffled' would sound nicer in this context
 
@sehe aren't you going to ask me "why would you DO this" like everyone else?
 
@stdOrgnlDave Nah I won't bother. I'm not gonna read it (well) either :)
crunching
 
it's going to take al ong time. 100 dereferences on 64mb I recall took about 70s
nm 9.4 minutes
vs 0 seconds for the control benchmark
 
ok, so if look down at line 35 of this I get a compile error that I can't call the constructor as it is protected. However, the super super class (not a typo) defines a friend class, which is where I am calling the constructor from‌​. What silly thing am I overlooking?
 
9:50 PM
you don't inherit friendship
 
indeed
your children are antisocial unless you specify otherwise
 
¬_¬ you already told me this
 
I did.
 
I fail at reading :(
 
Think about it. Just because your best friend can touch your privates, it doesn't mean they can touch your children's.
 
9:52 PM
god damn it. programming is not something to do when distracted
 
If you don't want to be distracted, you should not be here.
5
:P
 
@RMartinhoFernandes i think i read the same about a month ago, but slightly better worded
 
I put the smiley on a separate message just because I knew the message would be starred.
 
Apr 5 at 20:54, by Kerrek SB
11.3(10): Friendship is neither inherited nor transitive.
 
And now it probably gets unstarred.
 
9:54 PM
@classdaknok_t it doesn't work that way. And you knew that too
 
To be honest, I didn't.
 
room topic changed to Lounge<C++>: If you don't want to be distracted, you should not be here. [c++] [c++11] [c++-faq]
@classdaknok_t And now it goes straight to the topic.
 
@classdaknok_t but I'm here because I am trying to learn have nothing better to do :(
 
is the destructor of a class called before the ones of the member variables?
 
@RMartinhoFernandes yay! That's the second time for me. :P
 
9:56 PM
@bamboon Yes.
It would suck otherwise.
 
@thecoshman Look at the positive side: you should make a good source of entropy
 
The other one was "I seriously don't understand what I'm doing here in this chat room," IIRC. But oh well. I'm hungry and I've got left-over pizza.
 
@classdaknok_t Später?!
 
Friendship isn't symmetric, either.
 
9:57 PM
@sehe "Später" is "Later" in German.
 
@sehe I know what those words mean... but together they loose their meaning to me
 
@stdOrgnlDave That's an exception where raising can improve control flow.
 
does anyone know how to filter quesions based on an OR condition for tags
 
@CatPlusPlus Just because you say a girl can touch your penis, doesn't mean you can are allowed to touch her boobs
 
unrequited friendship - socially isolated, lonely, perverted classes trying to touch childrens' privates of their only friends...it's not intrinsic to the language to make these jokes. it is we who are the perverted
 
9:58 PM
Go to "advanced searching". It explains everything.
 
thanks
 
@thecoshman That's because you suck at reading and writing: either way you add enough entropy to approximate randomness
 
@sehe did you finish yet?
 
@RMartinhoFernandes yeah indeed thanks
 
@stdOrgnlDave pardon me?
 
9:59 PM
@thecoshman just tie her up.
 

« first day (565 days earlier)      last day (4384 days later) »