チケット #45481

savegame2.c still has variables named 'string'

登録: 2022-08-27 19:42 最終更新: 2022-09-05 11:43

報告者:
担当者:
チケットの種類:
状況:
完了
コンポーネント:
マイルストーン:
優先度:
5 - 中
重要度:
5 - 中
解決法:
修正済み
ファイル:
3

詳細

We've supposed to not use 'string' as a variable name even in C-code, to make sure we don't have problems with C++. savegame2.c still seems to use such variables.

チケットの履歴 (10 件中 3 件表示)

2022-08-27 19:42 更新者: cazfi
  • 新しいチケット "savagame2.c still has variables named 'string'" が作成されました
2022-08-27 19:51 更新者: cazfi
  • 概要が更新されました
2022-08-27 20:35 更新者: cazfi
  • 担当者(未割り当て) から cazfi に更新されました
  • 解決法なし から 受領 に更新されました
2022-08-27 23:43 更新者: None
コメント

We've supposed to not use 'string' as a variable name even in C-code, to make sure we don't have problems with C++.

How is that even a problem? "string" is in no way a C++ keyword, "std::string" is in a namespace, and local variables can shadow types. The issues with C++ compatibility arise when using "new", "delete", or other keywords as variable or function names.

2022-08-28 00:29 更新者: cazfi
コメント

Reply To (Anonymous)

We've supposed to not use 'string' as a variable name even in C-code, to make sure we don't have problems with C++.

"std::string" is in a namespace

Yea, it's unlikely that there's problems in any modern setup, but back in the days when it was customary for everyone to be "using namespace std" in whatever system header we faced problems with variables named 'string' (maybe as late as when we introduced Qt-client, but certainly back when we were using C++ based tolua fork)

2022-08-28 04:57 更新者: cazfi
コメント

Should note that his *reduces* diff between savegame3.c and savegame2.c (that diff was the reason I noticed this, as the same patch did not apply to both). Even if we completely ignore C++ aspect, I think this is still worth pushing in, for easing efforts to fix issues in savegame?.c modules (there's quite a many open ones at the moment)

2022-09-05 11:43 更新者: cazfi
  • 状況オープン から 完了 に更新されました
  • 解決法受領 から 修正済み に更新されました

編集

このチケットにコメントを追加するには、ログインが必要です » ログインする