Wireshark mailing list archives
initializing a variable with a non-constant value
From: Martin Kaiser <lists () kaiser cx>
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 ___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev () wireshark org> Archives: http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request () wireshark org?subject=unsubscribe
Current thread:
- initializing a variable with a non-constant value Martin Kaiser (Oct 14)
- Re: initializing a variable with a non-constant value Evan Huus (Oct 14)
- Re: initializing a variable with a non-constant value Guy Harris (Oct 14)
- Re: initializing a variable with a non-constant value Guy Harris (Oct 14)
- Re: initializing a variable with a non-constant value Evan Huus (Oct 14)