onsdag 30 december 2015

Why I hate everything Windows

These are just some issues that I simply can not understand how they can be allowed to stick around?!
  • When I mount a USB stick, I get a note about that my monitor does not have the optimal resolution set.
  • Then I compile a program using VS2010, or VS2015, domain name look-up does not work.
  • Adding a network drive with other authentication forgets the authentication if it failed to connect one time (which of course it will since I have connected network drives from many local networks).
  • The default (which I do not know how to sensibly change) timeout when trying to connect to a network drive is something like 30s. Now, the OS is stupid enough to verify these connections every time a file access is attempted by any software. And if the connection fails (after having being active, a not very unlikely scenario if I move my laptop) it will still try to connect EVERY time a file access is attempted. And this continues until the system is rebooted?!
  • If I want to save a word-file using save as, I have to activate editing of the document - ridiculous!
The list will be extended as I find more craziness.

Update 2016-01

I should probably actually generalize this to Microsoft products in general. How about this one:
I have to use two Office 365 mail accounts on the web belonging to two different companies. But the system can not handle that, so I have to log in and out every time I need to do something on the "other" account...

onsdag 2 december 2015

A suggestion for a C++1z feature

This is probably quite a controversial proposal. And I am by no standards a very skilled programmer. But anyway, I think this feature could be rather nice to have.

The idea is to have some kind of Post-constructor automatically generated and executed member function. A suggested name for this function would be initializer. It is not entirely clear to me how it should be run, but maybe in reverse compared to constructors, so that derived classes initializers are run before base classes.

The rationale for this proposal is; How many times have you seen code like:

class A{...};
class B : private A{...};
B m(param p);
m.Init();

Or something like that. The reason for this construction (that is, why the code that goes into init does not go into the constructor) is that Init calls some interface function from a member of the base class A to the derived class B. Now this interface function for sure will need stuff created when B was constructed, and hence it can not go into A's constructor. It can also not go into B's constructor since, B does not know about all stuff in A.

For this, a really nice solution would be if all classes run Init-functions in reverse automatically. Then if this function is not user created, it does not have to be run. However, if the user created it, it should be run automatically at the end of the constructor. Maybe it could be done in a fashion similar to the init list in the constructor, but appearing at the end of the function declaration instead? Something like:
B::B(param p) : ...{
...
} : !A()
Where I named the function !A.