PC Review


Reply
Thread Tools Rate Thread

Bug or Feature in C# sourcecode?

 
 
Thomas Lehmann
Guest
Posts: n/a
 
      27th Apr 2009
Dear all,

I am debugging a very complicated C# program, based on .NET 2.0. The
author was a real C# expert, which I am still not.

I saw something strange and try to find out, if this is a bug or maybe a
C# feature. It is part of a property:


set
{
fData[iOffset + iIndex * + iStepSize] = value;
}


The part "* +" seems to be a bug for me, or does this exist?


Thank you for your answers,
Thomas
 
Reply With Quote
 
 
 
 
Alberto Poblacion
Guest
Posts: n/a
 
      27th Apr 2009
"Thomas Lehmann" <(E-Mail Removed)> wrote in message
news:gt4s32$occ$(E-Mail Removed)...
> I am debugging a very complicated C# program, based on .NET 2.0. The
> author was a real C# expert, which I am still not.
>
> I saw something strange and try to find out, if this is a bug or maybe a
> C# feature. It is part of a property:
>
>
> set
> {
> fData[iOffset + iIndex * + iStepSize] = value;
> }
>
>
> The part "* +" seems to be a bug for me, or does this exist?



I believe that what the author probably meant was
iOffset+iIndex*iStepSize. However, there is a "unary +" operator, so
iIndex*+iStepSize would compile and yieled the same result as
iIndex*iStepSize (or in other words, the same value but with different sign
as iIndex*-iStepSize).

 
Reply With Quote
 
Cowboy \(Gregory A. Beamer\)
Guest
Posts: n/a
 
      28th Apr 2009

"Thomas Lehmann" <(E-Mail Removed)> wrote in message
news:gt4s32$occ$(E-Mail Removed)...
> Dear all,
>
> I am debugging a very complicated C# program, based on .NET 2.0. The
> author was a real C# expert, which I am still not.
>
> I saw something strange and try to find out, if this is a bug or maybe a
> C# feature. It is part of a property:
>
>
> set
> {
> fData[iOffset + iIndex * + iStepSize] = value;
> }
>
>
> The part "* +" seems to be a bug for me, or does this exist?


It is not advanced, complex code. It is merely an example of bad syntax to
get to a particular item in some sort of array or dictionary.

--
Gregory A. Beamer
MCP: +I, SE, SD, DBA

*********************************************
| Think outside the box!
|
*********************************************

 
Reply With Quote
 
Ignacio Machin ( .NET/ C# MVP )
Guest
Posts: n/a
 
      28th Apr 2009
On Apr 27, 2:04*pm, Thomas Lehmann <tlehm...@iup.uni-heidelberg.de>
wrote:
> Dear all,
>
> I am debugging a very complicated C# program, based on .NET 2.0. The
> author was a real C# expert, which I am still not.
>
> I saw something strange and try to find out, if this is a bug or maybe a
> C# feature. It is part of a property:
>
> set
> * * * * {
> * * * * fData[iOffset + iIndex * + iStepSize] = value;
> * * * * }
>
> The part "* +" seems to be a bug for me, or does this exist?
>
> Thank you for your answers,
> Thomas


Hi,

Weird yes, illegal no, the "+" is doing nothing there. Why this
"expert" did it like that is anybody guess.
Maybe it's a bug anyways
 
Reply With Quote
 
Thomas Lehmann
Guest
Posts: n/a
 
      1st May 2009
Dear all,

thank you for your answers!

Best regards
Thomas
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Html sourcecode Dave Microsoft VB .NET 0 1st Sep 2005 04:27 PM
Sourcecode format Aaron Microsoft Dot NET 2 30th Apr 2004 04:51 AM
Protecting your sourcecode www.mobidogs.com Microsoft Dot NET Compact Framework 10 26th Mar 2004 10:52 PM
Sourcecode Whiteboard Chuck Bowling Microsoft C# .NET 0 11th Jan 2004 03:04 PM
any unzip sourcecode available in c#? Matteo Cima Microsoft Dot NET Compact Framework 3 19th Nov 2003 09:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:07 AM.