eclipse-threadx/filex

Const keyword is missing for data parameter

Closed this issue · 4 comments

FileX will ensure that the incoming BUFFER will not be modified, so I think it is not necessary to use const keyword here.

Unfortunately this is not enough guaranty for aurhorities. Passing const pointer will result in at least warning, if not even error in some compilers.

Adding const has added value at robustness level and is not introducing backward compatibility break.

You are right. Const keyword is added in many other codes for data parameter, but I read FileX such as fx_file_write(), fx_media_write(), these functions are not added, all the source code is only some constant arrays use const, such as static const USHORT diff_table_range_low[].

@MaJerle Thank you for the feedback. We will not be able to change the api declaration as this will break the existing applications with compiler warnings