[haiku-commits] Re: haiku: hrev46669 - in src: add-ons/kernel/partitioning_systems/intel add-ons/kernel/file_systems/udf add-ons/kernel/network/datalink_protocols/ipv6_datagram system/runtime_loader/arch/arm system/runtime_loader

  • From: Adrien Destugues <pulkomandy@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 13 Jan 2014 21:57:03 +0100

> > udf: Move constant to header.
> >
> > This way, it is a compile time constant and Clang does no longer
> > complain about dynamic arrays of non-POD types.
> 
> Could anyone explain to me the difference? There should not be one.
> Whether something is in a header or a source file is completely
> irrelevant in C and C++ -- it's the same thing.

It was extern in the header before, defined in one .c file, but referenced 
in another to size an array. As a result, the size of that array was only 
known at link-time, making it dynamic.

Having the value known in the same compilation unit avoids that, and makes 
the array really fixed-size (at compile time).

-- 
Adrien.

Other related posts: