multiple unsequenced modifications

Sam Steingold <[email protected]>
Newsgroups gmane.lisp.clisp.devel
Message-ID <[email protected]>
Hi,

I get this:
--8<---------------cut here---------------start------------->8---
modules/rawsock/rawsock.c:893:48: warning: multiple unsequenced
  modifications to 'STACK' [-Wunsequenced]
--8<---------------cut here---------------end--------------->8---

because of

--8<---------------cut here---------------start------------->8---
  struct addrinfo hints = {addrinfo_flags(),
                           check_socket_domain(popSTACK()),
                           check_socket_type(popSTACK()),
                           get_socket_protocol(popSTACK()),
                           0,NULL,NULL,NULL};
--8<---------------cut here---------------end--------------->8---

It appears that the code _should_ DTRT in all commercial compilers and
GCC 3.4.6 or later.

https://stackoverflow.com/q/19881803/850781
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=11633
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#430

What should be done about this?

It is easy to rewrite the code (replace popSTACK() with STACK_??? and
add skipSTACK() at the end) but this would be a lie because
addrinfo_flags() modifies STACK too, so we are relying on the sequential
evaluation of all slots in the initialization no matter what.

The only honest way to avoid the issue is

--8<---------------cut here---------------start------------->8---
  struct addrinfo hints = {0,0,0,0,0,NULL,NULL,NULL};
  hints.ai_flags = addrinfo_flags();
  hints.ai_family = check_socket_domain(popSTACK());
  hints.ai_socktype = check_socket_type(popSTACK());
  hints.ai_protocol = get_socket_protocol(popSTACK());
--8<---------------cut here---------------end--------------->8---

Bruno, does it make sense?
It is worth bothering with?

Thanks

-- 
Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.1504
http://steingoldpsychology.com http://www.childpsy.net http://camera.org
http://americancensorship.org https://jihadwatch.org http://iris.org.il
"Bravery is being the only one who knows you're afraid." --Franklin P. Jones

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
clisp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.