admin管理员组文章数量:1406937
I have a method in a Bcrypt
algorithm that would of originally come from here /tree/main which has the following syntax:
for (int offset = 0, c1, c2; offset < length; )
{
...
}
Notice the two arguments c1
and c2
in the condition position. But I cant find any documentation supporting this syntax
This used to build using older versions (and still does build using older versions tested on 17.12.4) of visual studio but no longer builds with version 17.13.2 But the latest version of visual studio it throws the following build error
';' expected
I noticed in the source code for Bcrypt they actually refactored this to use a while loop /blob/main/src/BCrypt.Net/BCryptBase.cs#L401 but I'm reluctant to refactor this as it's the authentication for my website and there would be risk associated with refactoring or updating the code
Is the syntax of multiple condition arguments valid and this is a visual studio bug or am I missing something?
I have a method in a Bcrypt
algorithm that would of originally come from here https://github/BcryptNet/bcrypt/tree/main which has the following syntax:
for (int offset = 0, c1, c2; offset < length; )
{
...
}
Notice the two arguments c1
and c2
in the condition position. But I cant find any documentation supporting this syntax https://learn.microsoft/en-us/dotnet/csharp/language-reference/statements/iteration-statements#the-for-statement
This used to build using older versions (and still does build using older versions tested on 17.12.4) of visual studio but no longer builds with version 17.13.2 But the latest version of visual studio it throws the following build error
';' expected
I noticed in the source code for Bcrypt they actually refactored this to use a while loop https://github/BcryptNet/bcrypt/blob/main/src/BCrypt.Net/BCryptBase.cs#L401 but I'm reluctant to refactor this as it's the authentication for my website and there would be risk associated with refactoring or updating the code
Is the syntax of multiple condition arguments valid and this is a visual studio bug or am I missing something?
Share Improve this question edited Mar 4 at 10:20 JKennedy asked Mar 4 at 9:27 JKennedyJKennedy 18.8k21 gold badges127 silver badges214 bronze badges 15 | Show 10 more comments1 Answer
Reset to default 1This was a bug. I reported it when downgrading to 17.12.4, they said the fix was already in the pipeline.
I've verified it's fixed in 17.13.3.
本文标签: visual studioIs a For loop with multiple initialisation arguments in c validStack Overflow
版权声明:本文标题:visual studio - Is a For loop with multiple initialisation arguments in c# valid? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745052595a2639741.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
int offset = 0, c1, c2;
is basically the same asint offset = 0; int c1; int c2;
. – NotFound Commented Mar 4 at 9:34for (int offset = 0, c1, c2; offset < length; )
you have initialization asint offset = 0, c1, c2
conditionoffset < length
and empty iteration – Dmitrii Bychenko Commented Mar 4 at 9:42local_variable_declaration
states that it "declares one or more local variables" – Matthew Watson Commented Mar 4 at 10:05