Code Tips and Snippets


Not yet member?
Click here to register.
Only members can post comments

News on "2 stars level"

VirtualBox bridged mode: automatically nic select and VM start
Posted by pk on Sunday, October 09 2016 - 10:47:11
2 stars levelC LanguageLinux operating systemWindows operating system

If like me, you use a VirtualBox VM for developing server applications, you certainly have configured your VM with your network interface in bridged mode.

When you have to move your VM on a Laptop PC, and after that, each time you switch from a wired connection to a Wireless one, you definitely have been annoyed, having to update the network adapter on which the network is bridged.

You will see in this post how to develop a mini C program that allows you to switch automatically to the correct network interface and then start the VM.


Optimizing your C/C++ code by using register!
Posted by pk on Saturday, November 07 2015 - 15:48:25
2 stars levelC Language

During the seventies, at the very beginning of the C language, the register keyword has been introduced in order to allow the programmer to give hints to the compiler, telling it that the variable would be used very often, and that it should be wise to keep it’s value in one of the processor’s internal register.

Nowadays, optimizers are much more efficient than programmers to determine  variables  that are more likely to be kept into registers, and the optimizer does not always take the programmer’s hint into account.

So many people wrongly recommend not to use the register keyword.

Let’s see why!


 
yakpro rulez!

Site has been updated on Thursday, May 25 2017 - 09:16:27