« first day (945 days earlier)      last day (4002 days later) » 

7:00 AM
@Pubby 176 upvotes. Does this indicate that there are that many people out there that understand the value of this post. Or are the majority of them just bandwagoning?
 
@StackedCrooked I believe I saw it on Reddit a few weeks back.
 
Ah, reddit..
 
Either that or HN.
 
Oh hello Mysticial C:
 
7:02 AM
@Rapptz Oh that was a while ago...
@Magtheridon96 hi
 
> It seems to me that the real issue is not mentioned by the original question. Yes, "a b(c);" has ambiguous semantics; its interpretation depends on whether c is a type. But such ambiguity is not a matter of syntactic correctness.
There's something about C++ that entices people into having such elaborate discussions..
It's kinda like discussing chess tactics.
 
Because it's like sex
It's good when it's bad and great when it's good
 
What.
That's incorrect plainly because I get very comprehensible error messages when compiling code I'm in the middle of refactoring
 
This is best programming language in the world. (The atmospheric music is sufficient proof.)
 
7:15 AM
The C++FQA is crap but I thought that was funny
 
The Run-time Encapsulation part is bs
 
@Rapptz You mean Stroustrup's faq?
Oh, wait. You posted the link.
 
No the C++FQA.
that thing someone made to reply to all the C++FAQ lite items
 
People should write their code correctly. Why include a language feature that slows things down and allows people to leave their incorrectly behaving code undetectable?
 
> from libc.stdlib cimport atoi
;_;
 
7:18 AM
Ugh
They just need to chop out the incompatabilities and context parsing issues in C++.
Writing a full-fledged function declarations inside anything but a (the global) namespace, or inside of a user-defined type, should be an error.
BAM, you just saved the compiler a million context-sensitive bullshit nonsense things ti has to deal with.
 
@ThePhD And chop out existing code. Compatibility has always been a problem in innovations.
Unless if your that brutal.
 
I would prefer being brutal.
Because the longer you don't do it, the more crap code that piles up.
 
@ThePhD Uh..
 
@JerryCoffin I tried to learn C++ in 1999 and was not very successful. I started learning Java in 2000 and used it to write my first non-trivial code. Java was useful for me because it served as a stepping stone to learning C++.
So I don't hate Java.
 
You.. can't define functions within functions like that anyway
 
7:21 AM
However, looking at Java now I greatly dislike it's verbosity and lack of expressivity.
 
@ThePhD I hope those guys in standardization have the courage to do it.
 
@Rapptz Really? :3c
 
void func() { void func2() { return; } }
I live DANGEROUSLY.
 
It's silly that you can declare functions inside functions but you can't define them.
 
ON THE EDGE.
 
7:21 AM
@ThePhD Yes.
int main() {
    int f() {
        //
    }
} // error
(and not because it doesn't return anything)
 
@Rapptz I said declaration, not definition:
 
@StackedCrooked And they call it productivity.
 
yeah, well
 
That's why constructors are always fighting with ambiguous syntax and why they had to use curly braces as initializers in teh first place.
 
Ah I misread.
 
7:24 AM
If they just chopped out the nonsense, they could've saved themselves having to write out a new language syntax feature.
 
@Rapptz A couple of months ago I discovered that baking soda works very well as an antacid. It works better than antacids in my experience.
 
Well.. it's sodium bicarbonate.
 
Is baking soda sodium bicarbonate?
Well, that answers it.
 
yes
@Rapptz ..?
I don't know anything about the chemistry involved.
 
NaCO(2)
or something
 
7:26 AM
Maybe a compiler warning would be fine
 
Sodium bicarbonate + water == antacid
 
@StackedCrooked Sodium bicarbonate is an antacid. You can actually buy tablets of those at all pharmacies.
 
Man, I dunno
 
I mean, you wouldn't want to break backwards compatibility all of a sudden
 
@Rapptz is it NaCO2?
Or something else?
 
7:27 AM
@ThePhD NaCO2 I think.
 
@MarkGarcia At my pharmacy you can buy Rennie and Gaviscon.
 
Yeah, I was right the first time.
 
NaHCO3
 
Awww =[
 
H2CO3
 
7:27 AM
I remembered "Ate" means "full fo oxygen"
I thought the '2' covered it.
 
ite, ate... I don't know.
 
Coffee Mate
 
Bicarbonate is HCO3
Sodium is Na
 
@Rapptz that looks like an expression template
 
@Magtheridon96 Coffee Mite.
 
7:28 AM
So.. NaHCO3
@StackedCrooked lol
 
@Rapptz been working with boost::msm lately, hence
 
@MarkGarcia Antacids are usually calcium carbonate
 
BOOST_MSM_EUML_TRANSITION_TABLE((
Stopped + play [some_guard] / (some_action , start_playback)  == Playing ,
Stopped + open_close/ open_drawer                             == Open
),transition_table)
Very similar :P
 
@Rapptz That returns false if one component doesn't balance the other.
 
Usually because it also gives calcium supplements so two for one I guess
CPython could have been so cool!
 
7:31 AM
I forgot my chemistry. I was honestly good at class back then.
 
I recently realized that I get along with assholes quite a lot
Does that have any implications on my sexual desires?
 
It just looks like a bastardised Python.
@MarkGarcia I hate Chemistry (even though I took quite a lot of classes for it, so I guess my dislike for it is justified)
 
@Magtheridon96 You mean, real assholes? As in buttholes, anuses?
 
I had 2/30 for my chemistry exam when I was 17.
 
@MarkGarcia of course not /o/
 
7:32 AM
@StackedCrooked What topic? Balancing equations?
 
I had to redo the exam during summer. (I don't know if that is common in US.)
 
Summer School
 
Not summer school.
 
That's what we call it here
 
You study at home and take the exams again in august.
 
7:33 AM
Kids that fail retake it in Summer for credits
At least pre-college
 
It's like a second chance. If you fail those exams you have to redo the year.
 
Ell
Im likely gonna have to redo the year
 
@Ell We all redo the year.
:P
 
Only thing I'm failing now is Economics and Sociology
My professor has no explicit grading criteria and he's a fat cranky man. ;____;
 
Ell
If you get 2 U's out of 4 you're not allowed back for upper sixth
 
7:34 AM
However, I did pass the chemistry exam then. I also had to redo physics.
 
Ell
I don't want to come back xD
I'm gonna do fine on physics. Maybe okay on chemistry
 
The chemistry was about CH-4, C2-H6, etc..
 
Ell
It's maths and further maths which I'm destined to fail at
 
@Magtheridon96 Get along with him.
 
Ell
Organic chemistry?
 
7:35 AM
@MarkGarcia I try my best to do that
 
@Ell yep
 
@StackedCrooked Organic chemistry.
 
Ell
We do mostly organic and some inorganic
 
@Magtheridon96 Then just keep a low profile. You don't want to upset those kinds of teachers.
-anes, -enes, -ynes...
 
Organic chemistry is the lamest Chemistry of them all
 
7:38 AM
@Rapptz And often the most frustrating one. One mistake makes me feel like an idiot.
 
Organic Chem is just horrible. =[
 
@Ell What part of maths are you struggling with?
 
I took an exam about Alkanes just last week
 
@Magtheridon96 What is heptane?
 
C7H16
 
7:41 AM
God, I still remember that.
@Magtheridon96 7*2+2 == 16. Good. I still remember the formula.
 
My chemistry teacher is a fanatic about KMnO4
 
Nobody wants to summon me to fight the Iron Golem. =[
Y no one wants to fight Iron Golem.
 
And she has a very manly voice
Which is funny because she used to be a body builder before she was a teacher
 
@Magtheridon96 Potassium Permanganate?
 
7:43 AM
OH
PER meant it was FULL of oxygen
 
YES!!! I REMEMBER MY CHEM!!!
 
ate jsut meant it had it.
You jogged my memory there.
 
OH <- I see what you did there
 
HeHeHe.
 
HO HO H2O!
 
7:44 AM
@Magtheridon96 Hydroxide ion. You forgot the -1 (or is it +1)
 
-1
-OH
+H
H gives away its electron
 
OH.
 
because it's a pushover
Doesn't want a fight.
 
@ThePhD It's a messed up place.
 
@ThePhD You sure have a way of remembering things.
 
7:45 AM
@MarkGarcia Hydroxide ions lose electrons in my awesome presence
 
Yeah, man. Chemistry is cutthroat.
 
I remember that SMBC(IIRC) about that test in valence electrons.
 
Maybe I'm too low level to fight the iron golem. =[
q_q nobody can go through the game as low level as I can
 
Why are all ions in Harlem positively charged?
(I'll let you say the punchline)
 
7:47 AM
@ThePhD What game?
 
@DeadMG Dark Souls
 
lollerskates
 
.. Oh. People say I should be level 30+ in this place.
I'm level 26. ._.
Well, nobody in my level range who's gonna summon me. :D
 
brb- Updating OS
 
@R.MartinhoFernandes: What are the 3.5e rules for multiclassing, anyway?
 
7:53 AM
Would we able to make our own concepts/constraints?
 
... constraints for doing what?
 
templates
 
uh, yes
 
lolwut
wow...
 
8:04 AM
Is it safe to link .o files compiled with different compiler flags?
 
Lol
That's pretty badass.
 
@Pubby different warning flags are ok :)
but there are so many flags
I remember that for Visual Studio the "safe iterator" flags had to be the same for all .obj files.
 
Hm, how is it different if I create a static library out of compatible .o files and then link those?
 
@Pubby There's probably a few flags that will lead to bad things.
 
@Pubby There's no difference.
 
8:11 AM
I don't link objects with different -std flags btw but that's more due to linking with libstdc++ though.
 
I'm just wondering what to do if I have two binaries that share source files
 
I seem to recall that difference in rtti enabled/disabled can cause some problems.
 
Is there much to do at all? Don't you get multiple definitions?
 
No
 
8:13 AM
@LucDanton I actually haven't tried it yet, but why would there be multiple definition errors?
 
"huge_object build_new_object()"
How is that a good idea?
 
@Pubby What a 'binary' to you?
 
@ChristinaBrooks It idiomatic C++ explained "liberally".
 
@LucDanton Executable. Maybe I'm using wrong terms.
 
That presentation makes a very crude assumption that we have a shitload of stack space.
 
8:14 AM
The only thing that is not binary is source code.
 
@Pubby And in what way is the source shared?
 
@ChristinaBrooks Memory is cheap. Embedded systems aren't the common situation.
 
Plus, pointers are a necessity.
 
@LucDanton I want a server program and a client program, and they both use foodata.cpp for example.
 
@Pubby Oh okay. I thought you wanted to link them together or some such.
Do you?
 
8:17 AM
I don't think so. I don't want to compile stuff twice that doesn't need to be.
 
Use a shared llibrary?
 
Ah you want both executables to link the same .o file.
 
library
 
Okay, I'd look more into the build system then.
 
For example, say you wanted to access a HW register.
 
8:19 AM
I.e. if you have common/, server/ and client/ for the sources then I expect a sane build system to take care of the gritty details.
(It's hard to find and set up a sane build system.)
 
It's not possible without pointers or inline asm.
I'm not talking about CPU registers, but about memory "mapped" hardware.
 
@ChristinaBrooks No.
 
@LucDanton I'm using make which gives means I could either link common object files or create a static library and link to that. That's what I wasn't sure about.
 
Because without pointers, accessing an arbitrary chunk of memory is impossible.
 
Also the essence of the slides is "Pointers must not own resources."
 
8:21 AM
@Pubby Makefiles can handle this very well.
 
Own resources? What's wrong with refcounting?
 
You need to define a client target and server target.
 
@ChristinaBrooks Exception-safety considerations come to mind.
 
That's why we don't use exceptions.
 
8:23 AM
She's an embedded programmer
Hence why I mentioned it earlier
i.e. no point in actually discussing it imo
 
:-). Have you used the internet before or are you just a troll? — ben is uǝq backwards 11 mins ago
 
Embedded programmers use ref counting?
 
Yes, when you work on higher level applications.
Mach kernel uses refcounting, actually.
Mach "objects" are all refcounted.
FDs are refcounted.
 
Generally speaking, refactoring all the error-prone stuff into a class, i.e. RAII. It helps with exception-safety in particular but it's good old refactoring in general.
 
(that more of XNU than Mach)
that's
 
8:24 AM
@ChristinaBrooks Throwing out the baby with the bath water?
 
"Not forgetting ever to drop a ref-count/close a file" is its own reward whether it happens due to an exception or plum programmer error.
 
It's very hard to make do without refcounting in a multithreaded environment.
Where threads are arbitrarily allowed to send "objects" to each other.
Thread 1 sends an object to thread 2 and destroys it. But the kernel still has to keep it.
 
I dunno much on the subject, but it seems like refcounting would be bad in multithreading because it implies shared data
 
When the essential message is "Don't use X", you should not think "but X allows me so many things, why don't you want me to do those things?", you should think "then what do I use instead that allows me to do the same".
 
8:27 AM
@ChristinaBrooks Even if you don't throw exceptions, the standard library does throw them. And other libraries that you depend on may also throw exceptions. So you still need RAII.
 
That's why I don't use the standard library.
 
That's what I meant with throwing out the baby.
 
@ChristinaBrooks What?!!
 
Again, I use C++ for the sake of object oriented stuff. It just makes vtable management less of a pain.
 
You're sacrificing way too much because of your refcount ideal.
 
8:28 AM
C++ isn't C++ without the standard library.
 
She just uses C with Classes
 
@ChristinaBrooks If you find yourself doing a lot of 'bracketed' acquire/release operations you should definitively check out RAII.
It's the same idea: let the language deal with the boilerplate, just like for dynamic dispatch.
 
@LucDanton Nothing else is better.
Unless the standard guys does something more spectacular.
 
@LucDanton Using C++ magic would make things break so badly when you use something like a call continuation.
(that's basically a tailcall)
The stack gets deallocated, and the execution of a continuation is scheduled.
 
C++ is not a good fit for that.
 
8:31 AM
Because in kernel, you only get a 8k stack, so better not waste any space.
 
Pointers are your least concerns.
 
@ChristinaBrooks None of the code you posted has objects though.
Unless typedef structs are objects.
 
@ChristinaBrooks There is this style called "idiomatic C++". It is a set of conventions that are proven to be safe and reliable. If you follow those rules then you have a solid foundation. If you choose your own path then you are walking in the dark and there are many pitfalls. (And you are walking in the dark.)
 
Oh, I was just showing some terrible MIG code.
 
@Rapptz What meaning of 'object' are we using here?
 
8:33 AM
@LucDanton Java definition I think. i.e. a class with methods, members, et al.
 
@LucDanton Singletons?
 
I've showed this before, but here is a C++ driver object: pastebin.mozilla.org/2415434
 
@Rapptz Then that kind of struct is the same everywhere else.
 
Yeah I guess but I mean methods vs passing the struct around.
 
Except for the classes...
 
8:34 AM
A struct in C++ is implicitly typedef'd anyway and the only difference from class is its public default visibility
 
@ChristinaBrooks I'd use C and do the dispatch by hand. Using non-PODs and bypassing the function call mechanism is asking for trouble.
 
So see? My use of object oriented features of C++ is perfectly safe.
 
@ChristinaBrooks Strictly speaking no.
 
@ChristinaBrooks RAII introduces zero overhead when compiling with -O1 or higher (gcc).
You can see by looking at the generated assembly.
 
@ChristinaBrooks If you code it perfectly.
 
8:36 AM
Maybe you rely on the implementation. I don't like that kind of maintenance burden though.
 
RefCounts are one approach I try to avoid on embedded stuff. If an object pointer has to be communicated to another thread, the right to operate on it goes with it and the originating thread should never need to access it again, for deletion or otherwise, (unless pooled and it 'comes round again', ie. the consumer thread has, in turn, relinquished its use of it).
 
Xeo
@StackedCrooked Wuhuu. :)
 
I've only played 1-2 hours yet.
Kotori route.
 
Xeo
heh, Kotori is the best choice as a first route, I think
 
Ah, another problem is that this requires everything to be written in proper C++.
 
8:38 AM
@ChristinaBrooks What's the meaning of "proper" in there?
 
Xeo
@ChristinaBrooks What problem is there?
 
As in, if 60% of your application is written in C, and 40% in C++, you can't use RAII.
 
Xeo
Don't write C
 
@ChristinaBrooks Ouch.
 
@ChristinaBrooks Setting up (and tearing down) base classes is the exact kind of magic I wouldn't want around if you do that sort of stuff.
 
8:39 AM
Like, mutexes are implemented in C, physical map management is in C etc etc.
 
@ChristinaBrooks Yes, you can.
 
How?
A mutex doesn't have a destructor.
It does, but not like a C++ destructor.
 
Yeah - lot of libs written in C. I may not be nice, but it just is.
 
@ChristinaBrooks But a wrapping mutex class does.
 
@ChristinaBrooks Pick where you want it to live -- either it's a C++ type that exposes a C interface as well for the C parts, or it's a C type that can have a C++ wrapper.
 
8:41 AM
Okay, so honestly, what's the disadvantage of using OO features of C++ instead of using C with vtables?
 
Off-hand, I cannot remmeber ever destroying a mutex in any embedded project.
 
5 mins ago, by Luc Danton
Maybe you rely on the implementation. I don't like that kind of maintenance burden though.
 
@MartinJames Threading?
 
Xeo
@ChristinaBrooks Wait, what? Where did that come from?
 
Each thread has a bunch of mutexes.
 
8:42 AM
C++ versus C with pseudo-classes.
 
@Xeo PS: Scroll up, you're missing context.
 
I mean, I'm a C programmer.
After all.
 
Then use what you're good and comfortable with: C
 
But classes are nice, they save typing.
 
Yes, I create them, but never need to destroy them, (in my work, anyway).
 
8:42 AM
Hm.
 
blah_do_stuff(blah, stuff) vs blah->do_stuff(stuff)
 
@ChristinaBrooks They don't just save typing. They can save your life! Esp. with RAII.
 
Bypassing destructors is a big no-no compliance wise and not the kind of things I want to touch -- I like C++ in the first place for the destructors. If I have to double-check myself that everything works well then I lose what I wanted in the first place: RAII.
 
Xeo
@Rapptz I guess so. And I don't think I have the energy right after waking up for this.
 
It's not worth it
 
8:45 AM
@ChristinaBrooks Amounts to the same: define type, declare operations on types, define operations somewhere else. Sometime those operations are declared in the type definition, sometimes not. I don't see savings.
 
I guess those features can be helpful to some. But for some reason, I'm not a big fan of the 80% of the other C++ features.
 
@ChristinaBrooks It's much more than 80%.
 
@LucDanton Explicitly managing vtables and inheritance is a pain.
The compiler does it for you if you use "C++"
 
I know. But if you bypass destructors you have to check that your implementation produces sensible code just as explicitly.
@ChristinaBrooks Right. The point is, you're not using C++.
 
IIRC she uses Embedded C++
 
8:47 AM
C++ assumes destructors will be run.
 
Ah, okay. I agree with that.
 
@ChristinaBrooks I think you should strive for higher modularity. For example the implementation of diana::start in this file does various things. Also you are using dynamic dispatching (virtual methods) for implementing drivers (low level code). That's not wrong per se, but I think a more bottom-up design based on small reusable components would be better.
 
Dynamic dispatching is used on Darwin for implementing driver families.
 
Modern C++ is lacking in old code bases.
 
not as much as Wide! mwahahahahahahahaha
 
8:51 AM
@StackedCrooked Using it for driver development is HIGHLY discouraged.
 
I meant, on Darwin.
Because with the current architecture, you can't even throw an exception.
 
well, the body of "Existing Wide code" is about 100 lines at best and is not very old.
 
Even if you wanted to.
I meant XNU.
 
@DeadMG It only goes downhill from there.
 
8:52 AM
@DeadMG Do you have a link of your project? (Or are you doing it privately by yourself?)
 
Which is like, over 500,000 lines of code?
 
you can get the latest from bitbucket.org/DeadMG/wide
@StackedCrooked True, true.
 
@DeadMG Thanks.
 
I'm actually in the situation where I wish to implement several new features, and I kinda have an idea about how I want to do it, but sickness
 
Throwing an exception requires libunwind.
Which requires writing a kernel level implementation of libunwind.
 
8:53 AM
which is frustrating since I want to implement one in particular to drive the evolution of my Standard library.
 
But then, if you use a continuation inside an exception block, you crash the kernel.
 
@ChristinaBrooks I realize rtti and exceptions are generally not used when implementing drivers. However, modern c++ features like RAII, templates and policies are perfectly fine.
 
Ah, I believe templates are not used in XNU because C people don't like how they look.
 
Or should be perfectly fine. Since they don't lead to weird object code.
 
(not kidding)
 
8:55 AM
table-based EH doesn't lead to weird object code
 
moarning
 
@DeadMG Darwin ABI for ARM uses setjmp based C++ exceptions.
 
@ChristinaBrooks Everyone not used with templates don't like how they look. :)
@TonyTheLion Good morning.
 
@MarkGarcia And everyone who is used to them doesn't like how they look either.
 
@DeadMG Especially when their used as mathematical expressions. :D
 
8:57 AM
I like them. They're pretty cool and what not.
 
And even if your codebase doesn't have exceptions then using RAII still has great value.
 
@StackedCrooked In a driver?
 
Sure.
Just look at the generated assembly.
 
it's identical to doing manual cleanup yourself, except the compiler generates it for you
also the compiler can fold cleanup blocks when doing it with RAII that you might not be able to manually
 
But where is the fun in that?
 
8:59 AM
Clean up of what?
 
resources.
 
@MartinJames you never had to cleanup anything?
 
Kernel stuff tends to be more heap-oriented.
 
memory, file handles, locks, ...
 

« first day (945 days earlier)      last day (4002 days later) »