Jump to content
  • Advertisement
Sign in to follow this  
UnshavenBastard

[.net] why does this compile (C#)

This topic is 4613 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

		Point[] hatcharea = new Point[6]
				{	new Point(RightBtm.X,0), new Point(this.ClientRectangle.Right,0),
					new Point(this.ClientRectangle.Right,this.ClientRectangle.Bottom),
					new Point(this.ClientRectangle.Left,this.ClientRectangle.Bottom),
					new Point(this.ClientRectangle.Left,RightBtm.Y),
					new Point(RightBtm.X,RightBtm.Y),
				};

At the end of the last line, there's a surplus comma. shouldn't the compiler complain here? it doesn't. (VS .NET 2003)

Share this post


Link to post
Share on other sites
Advertisement
While the extra comma isnt needed the compiler will simply ignore it if it exists. It's by design that this isnt an error.

Share this post


Link to post
Share on other sites
Quote:
Original post by UnshavenBastard
ah ok, but in c++ this would be an error, right?
i was a bit confused :D


Nope. Don't think it is, in C, neither. (In fact, other languages may also have the same result.)

Share this post


Link to post
Share on other sites
I believe the reason for this may be the same as why you can do this:

enum SomeEnum
{
Option1,
Option2,
Option3,
};

I heard that the reason for this is that it's easier to generate automatically (as in computer-generated).

- Nick

Share this post


Link to post
Share on other sites
Quote:
Original post by NickWaanders
I believe the reason for this may be the same as why you can do this:

enum SomeEnum
{
Option1,
Option2,
Option3,
};

I heard that the reason for this is that it's easier to generate automatically (as in computer-generated).



yeah, that makes sense, that also came to my mind.

[Edited by - UnshavenBastard on November 29, 2005 3:14:21 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!