Thursday, September 15, 2016

Use of #pragma once

Fellow developers,

a short note that I have just committed a large change where we go from using double-include protection using

#ifndef filename_h
#define filename_h

...

#endif

But using the simpler, and less error prone

#pragma once

in the top of the file. The ifdef in the end of the file goes away.

Cheers,


Kristofer

3 comments:

  1. Cool. So this is now available cross-platform, cross-compiler!

    ReplyDelete
    Replies
    1. It is available on all compilers we use at least: https://en.wikipedia.org/wiki/Pragma_once

      Delete