[ 
https://issues.apache.org/jira/browse/THRIFT-4402?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Henrique Andrade updated THRIFT-4402:
-------------------------------------
    Description: 
Since the symbol TSocket::useLowMinRto_ is only used in TSocket.cpp, it can be 
declared and made static in TSocket.cpp itself (no need for it to be declared 
in the header file).

This way it will not be a global symbol in the corresponding shared file.

```
> nm -C ./lib/cpp/src/thrift/transport/TSocket.o | grep " B "
0000000000000000 B apache::thrift::transport::TSocket::useLowMinRto_
```

Unnecessary exposed global symbols like this can cause subtle dynamic linking 
errors:

https://stackoverflow.com/questions/6714046/c-linux-double-destruction-of-static-variable-linking-symbols-overlap

  was:
Since the symbol TSocket::useLowMinRto_ is only used in TSocket.cpp, it can be 
declared and made static in TSocket.cpp.

This way it will not be a global symbol in the corresponding shared file.

```
> nm -C ./lib/cpp/src/thrift/transport/TSocket.o | grep " B "
0000000000000000 B apache::thrift::transport::TSocket::useLowMinRto_
```

Unnecessary exposed global symbols like this can cause subtle dynamic linking 
errors:

https://stackoverflow.com/questions/6714046/c-linux-double-destruction-of-static-variable-linking-symbols-overlap


> Minimize global uninitialized symbol leakage (TSocket::useLowMinRto_)
> ---------------------------------------------------------------------
>
>                 Key: THRIFT-4402
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4402
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.10.0
>            Reporter: Henrique Andrade
>            Priority: Trivial
>
> Since the symbol TSocket::useLowMinRto_ is only used in TSocket.cpp, it can 
> be declared and made static in TSocket.cpp itself (no need for it to be 
> declared in the header file).
> This way it will not be a global symbol in the corresponding shared file.
> ```
> > nm -C ./lib/cpp/src/thrift/transport/TSocket.o | grep " B "
> 0000000000000000 B apache::thrift::transport::TSocket::useLowMinRto_
> ```
> Unnecessary exposed global symbols like this can cause subtle dynamic linking 
> errors:
> https://stackoverflow.com/questions/6714046/c-linux-double-destruction-of-static-variable-linking-symbols-overlap



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to