Performance, for(int i...) vs for(i...)
Tim Prince
n8tm@aol.com
Sun Aug 26 20:33:00 GMT 2012
On 8/26/2012 1:56 PM, Georg-Johann Lay wrote:
> Tim Prince schrieb:
>> On 08/26/2012 11:30 AM, lab@kayohamid.net wrote:
>>> Hello, I like performance, and until last month i follow what I see
>>> on the web to do better coding for performance, like:
>>>
>>> - Avoid i++, use ++i and so on.
>>>
>>> But now i'm using the assembly (-S) code generated to see if
>>> somethings is correct, and today i'm investigating this:
>>>
>>> int i;
>>> for(i = 0;....);
>>>
>>> vs
>>>
>>> for(int i = 0;...);
>>
>> [...] It's probably important to continue to handle the declaration
>> outside the scope well, as that version is required for C source code
>> by Microsoft compilers, even VS2012.
>> I have had occasion to wish that people didn't rely on non-standard
>> maybe Microsoft is right in forbidding both incorrect and correct C++
>> usage in C code.
>
> It's all vanilla C99, no C++ is needed for that.
>
> Just activate that language standard in your C compiler ;-)
>
> Johann
>
>
Nothing wrong with maintaining compatibility with a widely marketed
compiler, even if gcc does the job better.
--
Tim Prince
More information about the Gcc-help
mailing list