[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-bugs] #4421 [Tor Client]: Some pure functions have impure code
#4421: Some pure functions have impure code
------------------------+---------------------------------------------------
Reporter: Sebastian | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: Tor Client | Version:
Keywords: | Parent:
Points: | Actualpoints:
------------------------+---------------------------------------------------
two examples I found while checking this out were
smartlist_string_num_isin() which calls tor_snprintf(), which isn't
defined as pure. And some other pure functions use tor_assert(), which
does file IO. If I understand this correctly, pure functions shouldn't be
allowed to call impure functions nor do IO.
unfortunately, GCC only treats this as a hint to the optimizer, and
doesn't check to see if it makes sense.
Thanks to [4ZM] who brought up pure functions in #tor-dev :)
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/4421>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs