Pointer arithmetic to void* (uintptr_t)

This is a very important link regarding pointer arithmetic that is being taught incorrectly in many universities:


The best way for general arithmetic on pointers for most architectures is to use the uintptr_t  data type:

void calculateModulo(char *address) { 
    uintptr_t x = (uintptr_t)address; 
    uintptr_t y = x % 4;

Upgrade to gcc 6.3+ in Ubuntu

To upgrade gcc to gcc6 use the following commands:

sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-6 -y


To set the new gcc as default use the following:

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5

Syntax highlighing in Moodle

The main idea is that we need syntax highlighting to quiz questions.

Here are the requirements:

  1. a plugin that is updated frequently, preferable by more than 1 person.
  2. support for syntax highlighting to as many languages as possible, not only in editing mode within the editor but in the view mode of questions, pages etc.
  3. it has to be free.
  4. it is better that it is accessible from the buttons of the editor so that it is easily accessible from students who want to create quiz content.
  5. it should support moodle 3.3+

Continue reading Syntax highlighing in Moodle

Personal portal to the Internet