Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: [Wireshark-dev] initializing a variable with a non-constant value

From: Martin Kaiser <lists@xxxxxxxxx>
Date: Sun, 14 Oct 2012 19:36:26 +0200
Hi,

doc/README.developer says

Don't initialize variables in their declaration with non-constant
values. Not all compilers support this. E.g. don't use
   guint32 i = somearray[2];
...

In file.c, read_packet(), we do

  const struct wtap_pkthdr *phdr          = wtap_phdr(cf->wth);
  union wtap_pseudo_header *pseudo_header = wtap_pseudoheader(cf->wth);
  const guchar *buf = wtap_buf_ptr(cf->wth);


The two things are in contradiction and I'm wondering how to fix this.
Apparently, there's been no complaints about compiler problems with
read_packet() so I was wondering if the limitation in README.developer
is still required.

Any views about this? Or any idea which compilers could potentially be
affected?

Thanks,

   Martin