« first day (237 days earlier)      last day (4714 days later) » 

5:00 PM
@JustAnotherProgrammer there are big PHP and ASP.NET chatrooms on irc.freenode.org
@CatPlusPlus stating something that has been stated 1000x times before.
 
Does anyone know if there have been proposals to add reflection to C++? Asking a class for a list of his methods etc..? And why they were refused?
 
user379888
@CatPlusPlus: Thanks :)
 
@JustAnotherProgrammer Also you come from a C/C++ background yet yesterday you were asking us about a morass of unindented, horribly buggy code
 
@ÓlafurWaage I'm happy to reiterate if it saves someone from writing in this bloody mess.
 
@CatPlusPlus I write PHP code quite often. I also write C++ and Java code quite often. I'm still alive.
 
user379888
5:01 PM
@Potatoswatter: I am trying to do some future planning ;)
 
@ÓlafurWaage Wow, that seems like a comprehensive answer. Thanks!
 
user379888
and the code works fine now :P just removed the '&'
 
@StackedCrooked yw
 
@JustAnotherProgrammer I think you're a student with no actual background, so everything counts as planning…
 
user379888
@Potatoswatter: No actual background?
 
5:02 PM
I wish PHP died, burned and was finally completely forgotten.
 
@CatPlusPlus life is to much fun to be hating on stuff all the time. Take what you enjoy and stop focusing on the negative :D
 
@JustAnotherProgrammer i.e., a student
 
PHP is as not fun as it gets. :P
 
user379888
@Potatoswatter: Oh, Ok. I thought you mean I don't know anything :P
 
@CatPlusPlus in your opinion. :)
 
5:04 PM
@CatPlusPlus Oh gawd, I never want to see TCL again…
 
Does the machine code generated by the compiler still reflect the structure of the original code (like object relations and functions). Or is the result simply a list of instructions without any of the original structures left?
 
@StackedCrooked All the useful structure is still there :vP
Good reverse engineering can go a long way.
 
@StackedCrooked there will be some structure, but in many cases it will be changed.
 
It's machine code.
 
@CatPlusPlus for example: is it possible to deduce from the machine code that the original code was written in OO style or procedural style?
 
5:07 PM
@StackedCrooked No.
I mean, you could see vtables.
 
There are no objects in machine land.
 
But it's not really a good indicator.
 
@StackedCrooked It depends a lot on what you mean by OO. I would say yes.
 
@CatPlusPlus but if the application crashes you can get a stack trace. So there remain some of the original structure, right?
 
That is the call stack, the order in which stuff was executed.
 
5:09 PM
Member functions are just ordinary functions, with this passed either as an argument or by a separate register. Virtual calls look as any indirect call, e.g. by function pointers.
 
@CatPlusPlus Ok, so you can detect that virtual methods were used.
 
Knowing the compiler you probably could see and identify patterns. But keep in mind that optimisations can do a lot to the code.
Also inlining destroys some functions completely.
The order of instruction after optimiser passes might not be the same. The patterns might change.
 
Is "-fomit-frame-pointer" something that makes it impossible to generate stack frames?
Apologies for jumping to another topic so suddenly :)
 
Impossible or really hard.
(I take it you mean stack traces. :P)
 
@StackedCrooked No, some platforms like PowerPC never have a frame pointer. Backtraces work just fine there.
 
5:12 PM
What does this compiler option do then?
 
Well, yeah, architectures differ.
 
RTFM?
 
On x86 it makes compiler reuse EBP register.
 
@LucDanton I could do that yes :)
 
It's a one more register to use, but it's not worth using IMO.
 
5:13 PM
-fomit-frame-pointer
           Don't keep the frame pointer in a register for functions that don't
           need one.  This avoids the instructions to save, set up and restore
           frame pointers; it also makes an extra register available in many
           functions.  It also makes debugging impossible on some machines.

           On some machines, such as the VAX, this flag has no effect, because
           the standard calling sequence automatically handles the frame
           pointer and nothing is saved by pretending it doesn't exist.  The
 
But there is nothing wrong with asking a fellow human being.
 
(Unless you really use architecture that can do without the frame pointers.)
 
That was man gcc + /omit-frame-pointer
 
The frame pointer, is that pointer to the beginning of the stack segment within a function scope?
 
No, it's a pointer to a previous frame.
 
5:15 PM
That would be the stack pointer
 
@CatPlusPlus what is a "frame" exactly?
@CatPlusPlus Ah I see, it's the point it has to return to after the current function has finished?
 
Stack frame holds information about the state of the function. Return address, locals, that sort of stuff.
 
@CatPlusPlus Have you some experience with assembly? Or are you simply well informed? :)
 
@StackedCrooked No, return address is in the current function's stack frame. Frame pointer points to a previous one.
(I.e. the function that called the current one.)
@StackedCrooked Bit of both. :P
 
@CatPlusPlus I think I'm gonna delve into that a bit.
> Don't keep the frame pointer for functions that don't need one
Which functions don't need frame pointers?
Inlined functions I guess.
 
5:24 PM
@StackedCrooked An inlined function essentially doesn't exist in the ouput, it's instead "in-lined" as a part of the calling function.
 
@CatPlusPlus You are confusing frame pointer and dynamic link. The frame pointer point to the stack frame of the current function. It is somewhat redundant with the stack pointer, but using that one may be inconvenient.
@StackedCrooked Those without local variable. Having a frame pointer may be also needed for stack unwinding.
 
@AProgrammer That makes sense.
Is an argument passed by value a local variable?
 
@StackedCrooked That depends really.
 
I for myself have sworn to never answer a question simply with "it depends".
:)
@KhaledNassar Ok, so on what does it depend?
 
Fair enough.
The type of the data passed
on x86, an int passed by value is not a local variable.
 
5:30 PM
@StackedCrooked, the target machine, the type of data passed, the usual convention of the OS, ...
 
But does this mean that the concept of "local variable" still exists at the machine level?
 
today was my highest gained rep ever in one day
 
local variables can be created on the stack (on x86) by decrementing the ESP register by the size of the type of the variable.
 
290
 
5:33 PM
@DeadMG Way to go :0
 
@Khaled: That's still not the same as a local variable though
no destructor call
 
@DeadMG It still bears the concept of locality to a specific function
 
in the context of C++, local variables make guarantees about exceptions, scope exit, etc, which the hardware certainly does not
 
But yes, of course it isn't a local variable as defined by C++.
 
@DeadMG I got 73 rep by answering only one question which wasn't upvoted.
 
5:36 PM
Has everyone ever done IPC by transmitting audio signals over the speakers and receiving them via the microphone?
I don't mean human communication.
 
@StackedCrooked May I ask why?
 
@StackedCrooked With the spearkers and microphone at opposite end of line phones, that's called modem.
 
A recent post asked about a straightforward way to do IPC. This made me wonder about this..
 
@StackedCrooked boost::interprocess?
 
@KhaledNassar Yes, that's very good.
I'd like to try out Google Protocol buffers.
 
5:38 PM
Analog IPC sounds hilarious.
 
@StackedCrooked: You mean like, how dial-up internet works
?
 
@DeadMG yea, but modems are only noisy while connecting. Internet traffic doesn't use audio signals. (If I'm not mistaken.)
 
I think he meant more of, your speaker emitting ungodly noise which the microphone (on the same machine) is recognizing as data.
 
@KhaledNassar Yes, little blips and beeps.
Perhaps using the text to speech features would be even more hilarious.
 
I gotta admit though, this is some insanely interesting idea :)
 
5:40 PM
This kind of modems:
 
@KhaledNassar It would allow networking without a network card :D
 
@StackedCrooked They are using sounds.
 
But bandwidht would be pretty low.
 
@AProgrammer What is this type of modem called?
I've never encountered any of those in my life.
 
@AProgrammer I see. Never actually had telephone internet in the past. I waited until cable was available.
 
5:42 PM
In telecommunications, the term acoustic coupler has the following meanings: # An interface device for coupling electrical signals by acoustical means—usually into and out of a telephone instrument. # A terminal device used to link data terminals and radio sets with the telephone network. The link is achieved through acoustic (sound) signals rather than through direct electrical connection. History and applications Prior to its breakup in 1984, Bell System's monopoly over telephony in the United States allowed the company to impose strict rules on how consumers could access their ne...
 
@AProgrammer Thanks
Damn, 9 years before I was born. :')
 
Cable and fiber are capable of sending multiple simulteaneous data streams. Would this also be the case for analog audio communication?
What is this phenomenon called again? Coctail party or something.
 
Multiplexing?
 
The cocktail party effect describes the ability to focus one's listening attention on a single talker among a mixture of conversations and background noises, ignoring other conversations. The effect enables most people to talk in a noisy place. For example, when conversing in a noisy crowded party, most people can still listen and understand the person they are talking with, and can simultaneously ignore background noise and conversations. Nevertheless, if someone calls out their name from across the room, people will sometimes notice (the "own name effect"). Another aspect of the cockt...
@LucDanton yep, audio multiplexing would be cool too.
Actually the Coctail Party effect is similar to tuning a radio/tv signal.
 
@StackedCrooked You can multiplex (either in frequence -- hey, it's how you can receive several radio stations -- or in time).
But I don't think it was often used with these.
 
5:46 PM
Like this chat sometimes has multiplexed conversations.
The chat window should demultiplex them. The result would be like a split screen for each conversation.
Sleep deprivation makes me come up with weird ideas :)
2
Does anyone know what would be the max theoretical throughput (MB/s) of the entire electromagnetic spectrum?
 
well, the electromagnetic spectrum is infinite, so infinite
 
∞ MB/s sounds nice.
 
@StackedCrooked Gamma radiation sounds bad, though.
 
@DeadMG but doesn't the max throughput diminish at higher frequencies? So it would be an asymptote. The surface of the graph would not be infinite.
@Potatoswatter We can use that for the poor.
 
last I checked, higher frequency means higher throughput
 
5:56 PM
@DeadMG yeah, that's right.
I wish I was an engineer instead of an ignorant informatician.
 
In physics, the unit of energy in the system of natural units known as Planck units is called the Planck energy, denoted by EP. :E_p = \sqrt{\frac{\hbar c^5}{G}} \approx 1.956 × 109 J \approx 1.22 × 1028 eV \approx 0.5433 MWh where c is the speed of light in a vacuum, \hbar is the reduced Planck's constant, and G is the gravitational constant. EP is a derived, as opposed to basic, Planck unit. An equivalent definition is: :E_p = {\frac{\hbar} {t_p}}, where \ t_p is the Planck time. Also: :E_p = {m_p} {c^2}, where \ m_p is the Planck mass. The ultra-high-energy cosmic ...
^ If you go too high in the spectrum you make a black hole. That also doesn't sound good.
Funny thing about the universe is that nothing is actually infinite :v)
 
> Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.
Albert E.
 
@AProgrammer it's missing universal-character-name
@KhaledNassar He also presumed the cosmological constant made the universe flat. Later on he admitted this was an error.
(flat universe = infinite)
In other words, he did make up his mind about the former later on.
… well i'm distorting the facts a bit but c'mon
 
@Potatoswatter Oh I wasn't using the quote to refer to the infinity of the universe. :)
Rather pointing out that something in the universe is infinite.
Misanthropy ftw.
 
6:07 PM
In Unix you can do things like this: echo "Abc" | program
How do you write a C++ program that supports this kind of input? I guess it's just std::cin?
 
@StackedCrooked yep.
 
@Potatoswatter so if you program supports two modes of running: one by streaming, and one by passing a filename argument. Then how do you know which one to use inside your program?
 
checks the arguments of main
 
@StackedCrooked Most programs stream if no filename argument is found.
 
@Potatoswatter How do you detect the stream?
std::cin.get?
 
6:12 PM
@StackedCrooked There's no detection to do… the stream is std::cin. If no filename argument is found, treat cin as the file.
This is why you should never store or pass std::fstream & as a function argument.
(aside from the purely generic conceptual reason that it's wrong)
 
@Potatoswatter I don't see how you come to this conclusion?
 
@StackedCrooked because fstream doesn't extend iostream aside from having a special constructor and open/close methods.
There is no good reason to use that type at all unless you plan to close and re-open or re-target the file.
 
@Potatoswatter And how does this make it a bad function argument?
Cool OSX doesn't have recursive mutexes.
 
@StackedCrooked If a function requires an fstream &, then it cannot accept std::cin because the type requirement is too specialized.
There is also the completely separate reason that fstream being more specialized than iostream breaks overload resolution for e.g. operator << templates.
 
@Potatoswatter But it can accept an istream& right?
 
6:19 PM
Again this is a side effect of the wrong decision to require a more derived type than necessary.
@StackedCrooked No, istream is a superclass of fstream so it does not suffice.
 
@Potatoswatter Aaah I understand your point now!
Ok, now I lost it again.
istream does not suffice because it si a superclass of fstream? Heh?
 
Lol… just try implementing a few example functions and you'll get it drilled right in :vP
 
@Potatoswatter I'm kindof unable to follow with you, do you, by any chance, mean the violation of LSP?
 
@StackedCrooked If a function takes an fstream & argument, then you can pass an object of fstream or any derived class.
iostream is in the other direction on the inheritance hierarchy.
 
@Potatoswatter I see what you mean, the function should accept an istream argument instead, right?
 
6:21 PM
@StackedCrooked Exactly.
 
I first thought you meant that there was something particular about fstream& that makes in unsuited to be a function argument. :)
Never mind.
 
For a second I thought you were talking about the design of fstream..
 
Does anyone know how to use PTHREAD_MUTEX_INITIALIZER in an constructor initializer list.
 
Isn't that one supposed to be used for static init only?
 
@LucDanton yeah, it is a define that resolves to an array literal which can be assigned to a struct. However it only seems to work using the obj = PTHREAD_MUTEX_INITIALIZER; syntax
My workaround is now:
 
6:28 PM
in that case, shouldn't obj(PTHREAD_MUTEX_INITIALIZER) be fine?
 
inline static pthread_mutex_t GetFastNativeMutex()
{
    pthread_mutex_t result = PTHREAD_MUTEX_INITIALIZER;
    return result;
}
@DeadMG that doesn't work!
pthread_mutex_t result(PTHREAD_MUTEX_INITIALIZER); leads to error: expected primary-expression before '{' token
 
`# define PTHREAD_MUTEX_INITIALIZER \
{ { 0, 0, 0, 0, 0, 0, { 0, 0 } } }`
 
@KhaledNassar Indeed.
 
when uniform initialization gets here
 
> PTHREAD_MUTEX_INITIALIZER can be used to initialize mutexes that are statically allocated.
 
6:33 PM
@LucDanton I do find the wording "statically allocated" confusing? Does it mean stack-allocated?
Or does it mean that it can only be used to initialize static variables??
 
The latter.
 
The latter.
 
So you are not allowed to use it for local or member variables? Damn!
So my little function above GetFastNativeMutex was totally wrong?
Or do I only need to make the result variable a local static?
 
I think the idea is that you will use the provided initialization function for normal stuff
 
6:40 PM
I'm checking if you can pass pthread_mutex_t around but I can't find anything one way or the other
 
In C++ that's all unnecessary, result = {} does the same thing.
and even in C result = { 0 } is equivalent.
 
The same thing as what is specified for a particular platform, maybe
 
Missing items in aggregate initialization are zero-initialized.
 
In any case I highly suggest not returning pthread_mutex_t
 
No platform dependence here.
 
6:42 PM
If a zero initialized pthread_mutex_t were always valid presumably they would never have specified PTHREAD_MUTEX_INITIALIZER
 
@LucDanton Remember the one infinite observable quantity in the universe ;v)
 
up to 320 rep today
 
There's nothing stupid about defining a C interface meant to be portable at the source level
 
Anyway the problem isn't that it's specified, just that it's over-specified.
It still serves a useful purpose, you don't want users leaving variables entirely uninitialized.
 
why not just use the provided initializer function for a member variable?
as stated, it's only provided for static variables because you're supposed to call the function for normal variables
 
6:45 PM
@Potatoswatter Leaving room for implementations to do as they please is a good way to future-proof
 
@LucDanton Well, the given code is completely tied to a specific implementation, and minimally future-proof. {0} is optimal.
 
It's optimally non-sensical
 
It means "zero-initialize everything"… which is the only thing that makes sense in this design space.
You can't call a function in this context.
 
0
Q: Initializing pthread mutexes.

StackedCrookedAccording to the documentation a mutex can be initialized in two ways: Using the init function: pthread_mutex_t theMutex; pthread_mutex_init(&theMutex, NULL); Using an initializer macro: pthread_mutex_t result = PTHREAD_MUTEX_INITIALIZER; About the latter the documentation says: In...

 
And a lot of users are going to use calloc to obtain "initialized" memory one way or another.
 
6:48 PM
> which is the only thing that makes sense in this design space.
Why?
Why couldn't an implementation be free to use a magic number?
You argued against over-specification; but your solution over-specify much more
Posix specifiy that there is a valid static initializer to be used.
You argue that it might as well be { 0 }; but that's more restrictive
 
I'm not saying the implementor should guarantee that it will always be the same as zero-initialization.
I'm saying that { 0 } is a more future-proof implementation.
 
How is { 0 } not zero-initialization?
 
You are talking about a guarantee made to users; I am talking about an internal implementation.
I don't think that the contents of PTHREAD_MUTEX_INITIALIZER convey any guarantee to the user.
Anyway, if I recall correctly, on Darwin (which is the source of the example, right?) a magic number is inserted when the variable is actually used the first time.
 
> The effect shall be equivalent to dynamic initialization by a call to pthread_mutex_init() with parameter attr specified as NULL, except that no error checks are performed.
Of course there's a guarantee
 
Xeo
@DeadMG, you're 2 places before me on the month rank! :|
 
6:54 PM
struct PosixMutex
{
    PosixMutex()
    {
        pthread_mutex_init(&mMutex, NULL);
    }

    ~PosixMutex()
    {
        pthread_mutex_destroy(&mMutex);
    }

    pthread_mutex_t & get() { return mMutex; }

    const pthread_mutex_t & get() const { return mMutex; }

private:
    PosixMutex(const PosixMutex&);
    PosixMutex& operator=(const PosixMutex&);

    pthread_mutex_t mMutex;
};
 
@LucDanton The macro is specified to do something, of course. The specification is not identical to the implementation.
 
Problem solved :D
 
@Potatoswatter So you just called the Posix design stupid on a whim. Them's fighting words you know
 
@Xeo: nyaha, you suck :P
 
A user who takes {0} as a guarantee that calloc is sufficient is wrong, and likely would make the same conclusion if they saw { 0, 0, 0 …
@LucDanton How so?
14 mins ago, by Potatoswatter
@LucDanton Remember the one infinite observable quantity in the universe ;v)
I still don't see how one implies the other.
 
6:58 PM
(Why is this not in the faq?)
 
Clearly you are completely missing the difference implementation vs specification.
 
Clearly I'm not
 
POSIX is a specification.
Darwin is an implementation.
I called Darwin's use of extraneous zeroes stupid… although it's not as dumb as carrying on this argument.
 
From the context of the discussion when you joined in, it really seemed like you mention {} as an alternative to PTHREAD_MUTEX_INITIALIZER
i.e. by this point it was never mentioned from which implementation the { 0 ... } define was taken
 
Fair nuff, I inadvertently suggested non-compliant code.
I hadn't yet read that the given macro came from POSIX, don't know if that had been said yet.
 
7:01 PM
Well Posix is only going to go by #define PTHREAD_MUTEX_INITIALIZER
SYNOPSIS
       #include <pthread.h>

       int pthread_mutex_destroy(pthread_mutex_t *mutex);
       int pthread_mutex_init(pthread_mutex_t *restrict mutex,
              const pthread_mutexattr_t *restrict attr);
       pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
But that's a man page, not the specs
 
Personally I call pthread_mutex_init and never noticed the macro alternative.
 
 
1 hour later…
8:03 PM
anyone around?
 
8:18 PM
Present!
 
hello
how was your day?
 
҉· _ · ҉
 
8:37 PM
Thesaurus is really handy for finding good variable names.
 
Xeo
@Potatoswatter Those circles look like something made with conway's game of life...
 
@Xeo Keep staring and they start spinning!
 
Xeo
8:49 PM
@Potatoswatter Keep starring and they stare back at you!
room topic changed to Lounge<C++>: Sex. Why? Just because.
3
 
always with the sex isn't it
 
oh cool topic :)
 
9:05 PM
lol
 
Xeo
@TonyTheTiger Why did you star that? Now everybody's going to know I did it!
I can't even edit it anymore. :(
 
It's ok… Sexual Failure Is Not An Error
 
I would pin it, but that would be abuse ;p
 
Xeo
:(
 
9:14 PM
I got an exam on Tuesday
 
@DeadMG Is your academic period ending?
 
why yes
it is
likely ending in my horrific failure, unless the exam board is impressed by my sickness claim
 
@DeadMG "blood, sweat, and code"!
 
Xeo
Better impress them by a nude dance during the exam.
With the "nude" part being optional.
 
lol
don't think they'd be impressed
also, my course has contained depressingly little code to date
I'd really appreciate a module that contains useful things, like, "Do not use exceptions as control flow", and, "Do not use static variables."
 
9:19 PM
@DeadMG Just eschew periods for semicolons. Same difference.
 
lol
 
Xeo
@DeadMG We have proven that you can use exceptions for control flow! For good control flow even!
 
lol
good times
 
Xeo
Even better with templated subclasses of the exception and automated downcasting done by the compiler.
 
lol
 
9:31 PM
@Xeo Given that throw operates by copy, isn't the most derived type always the dynamic type? So catch(some_type const&) would always be an upcast?
 
Xeo
@LucDanton Yes, but consider the rethrow here.
(In foo.)
 
This reactivates the first throw, so still the same dynamic type.
 
Xeo
Anyways, I like how exceptions work. Totally different from normal C++ code. :)
 
For that same exact reason boost::exception is abstract to avoid catch(boost::exception const& e) { throw e; } which would slice, unlike using throw;.
 
Xeo
9:53 PM
 
10:10 PM
('~')
 
10:43 PM
Real examples in Qt where bugs where caused by breaking strict-aliasing rules in C++: labs.qt.nokia.com/2011/06/10/type-punning-and-strict-aliasing
(From the C++ subreddit)
I think this may be relevant for the code at my work.
> The above will probably work (emphasis on probably), but the results are undefined. That means the compiler is free to do anything, like emailing your boss about this transgression.
I wonder, how can you parse incoming network data without breaking the anti-aliasing rules?
 
Xeo
@StackedCrooked Why can't you?
> The above can print three different things (or defrost your fridge)
I love such examples what can happen with undefined behaviour. :)
 
How would you parse an IP header? I would use a define the IPv4 header as a POD and use memcpy to initialize it with the network data. I'm not sure if this is breaking anti-aliasing rules though..
 
Xeo
> memcpy
 
@StackedCrooked it isn't
 
Then provide getter methods for values bigger than 1 byte, in order to get byte order good.
 
10:53 PM
memcpy would be rather pointless otherwise ;)
 
@Xeo memcpy, like a boss.
 
Xeo
No, I wanted to hint at the copy (cpy) in memcpy.
 
also, chars are allowed to alias other types
 
@jalf that's good to know
 
Xeo
@jalf What's the difference between memcpy and memmove anyways?
 
10:54 PM
@Xeo one handles overlapping ranges, the other doesn't?
well, except that I believe memcpy is typically implemented as memmove anyway, because there's little cost to handling overlapping ranges
the aliasing rules are complex enough that I can't remember every corner case, but the char thing should give you enough loopholes to do something practical
 
Xeo
Though, imho memmove is misleading. Especially with C++ and the moving stuff
 
yeah, but you have to admit they had the name first ;)
 
I remember someone mentioning that you could use a union for the buffer and the struct. But that is UB I think because you are first writing the buffer, and then reading the struct.
 
why yes, it is UB
 
there's something about rvalues and lvalues too. litb wrote some fancy cast that got around the aliasing rules too
by returning a rvalue
 
Xeo
10:57 PM
Though, every compiler I know implements it correctly. ("correctly" as in "working the way you want it to")
 
the union trick is UB strictly speaking, but popular compilers explicitly allow it anyway
so it is pretty safe
 
The idea of "moving memory" always strikes me as odd. When I was a young boy I read in a book from the library that memory can not be moved. It can only be copied. So moving data from A to B implies that data is copied from A to B.
 
but the aliasing rules are pretty high on my todo list. Really need to read up on them
 
That kind of stuck.
 
@StackedCrooked yeah, I believe the logic is that "you don't care about the source range", and so it is ok for it to be partially overwritten because it overlaps the destination range
so in that case it is a kind of move
 
Xeo
11:00 PM
Hm. I just read up on iterator_facade from Boost. That's pretty cool stuff
 
yeah, definitely
 
sleep: I need some
 
me too
 
need to get back into normal sleeping habits after the all-nighters I did last night and the night before
 
We all do.
Sometimes I can program better when sleep deprived.
I think it's because the reduced capability of my brains I can't afford to become distracted. Or something like that.
 
Xeo
11:04 PM
Related:
 
Ha, good old one.
Ok, time for a little bit of "Elements of Programming"
Belgium has now been 363 days without government. Yay, countdown time!
 
Xeo
whut?
 
@Xeo A little late to the party?
 
Xeo
11:20 PM
Seems like it.
But on the other hand, I'm not really interested in politics.
 
Neither am I, but it sure has been entertaining here lately.
 
I think everyone should be interested in politics. But unfortunately we have lots of people uninterested and lots of people interested in power.
 
template<class MutexType, class VariableType>
class ThreadSafe { /*...*/};
I want to create a typedef that only specifies the first argtype (and leaves the second unspecified). No template typedefs in C++03, any workarounds?
Inheritance could work, but doesn't seem like a clean solution.
 
Xeo
@StackedCrooked How about inheritence?
 
@Xeo haha
 
Xeo
template<class MutexT>
blub : ThreadSafe<MutexT, int>
{};
 
Ok, I can use inheritance. But then I'll also need to reimplement the constructors and forward the args to base class.
 
Xeo
11:46 PM
using ThreadSafe<MutexT,int>::ThreadSafe?
Don't know if that works
Oh, better
 
@Xeo I'm very unfamiliar with the possibilities of the 'using' keyword. I'll see if I can make it work.
 
Xeo
template<class MutexT>
struct ThreadSafeInt{
  typedef ThreadSafe<MutexT,int> type;
};
ThreadSafeInt<Mutex>::type tti;
 
It's the MutexType that I'm specifying :)
class ThreadSafe<class MutexType> : public ThreadSafe<PosixMutex, MutexType>
 
Xeo
Whatever
Works either way
 
Can't remember if using declaration + constructor was axed for C++0x, I'd better check
It's still in
 
11:59 PM
Constructor inheritance is C++0x. Oop.
 

« first day (237 days earlier)      last day (4714 days later) »