Loading...
 
Multi-Language Add-In for Visual Studio

Multi-Language Add-In for Visual Studio


Avoid using strings in ml.ml_string

Hello,

I would like that when invoked from source code the ml.ml_string() function, the original string passed as second parameter were avoided, as this overloads the executable size and slows execution. Is there any way that the original string is displayed as a comment? Something like:

ml.ml_string(587 / * High * /);


Thanks

Germany

Hi,

I will think about this for C#.

For VB, the answer is no. VB has no syntax to embed a comment within a line.

For unmanaged C++, it is not an issue, because I have defined ML_STRING as a macro. The unused parameter does not generate any code.

For managed C++, I don't think it is a macro (are there macros in managed C++?). However, hardly anyone uses managed C++.

For C# you are probably correct. It will bloat the code and could slow it down. Actually, I think there is a chance that the compiler optimizes it away completely in a release version, but I don't know if it does.

Also, you would have to have a lot of strings in your program for this to make an appreciable difference. I used to worry a lot more about the size of programs than I do now. Nevertheless, it is a fair point, and I will look into how difficult it would be to implement.

Phil

> Hi,
>
> I will think about this for C#.
>
> For VB, the answer is no. VB has no syntax to embed a comment within a line.
>
> For unmanaged C++, it is not an issue, because I have defined ML_STRING as a macro. The unused parameter does not generate any code.
>
> For managed C++, I don't think it is a macro (are there macros in managed C++?). However, hardly anyone uses managed C++.
>
> For C# you are probably correct. It will bloat the code and could slow it down. Actually, I think there is a chance that the compiler optimizes it away completely in a release version, but I don't know if it does.
>
> Also, you would have to have a lot of strings in your program for this to make an appreciable difference. I used to worry a lot more about the size of programs than I do now. Nevertheless, it is a fair point, and I will look into how difficult it would be to implement.
>
> Phil

I think that using comments is a fancy way that reduces the processor and memory overhead and almost does not affect the readability of the code :-)

Thank you