473,387 Members | 1,520 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

BUG: struct default constructor is not displayed on intellisense yet it is available, BUG

BUG: struct default constructor is not displayed on intellisense yet it is
available, BUG

Make a struct type with a parameterized constructor.

Try to construct the type in the IDE and check for the 2 overloads (Default
AND the parameterizedone) the default one is NOT displayed thus

giving the FALSE impresison that it DOES NOT exist.

BUG
Jul 21 '05 #1
4 1384
A struct always has a default constructor, since structs are value types.
As soon as you declare one, all the fields are initialized - so it is as if
you called it, without really having to call it.

You can argue that this is a bug, but it seems like it may have been a
deliberate decision to leave it out, given the behavior of structs.

"news.microsoft.com" <di********@discussion.microsoft.com> wrote in message
news:eY*************@TK2MSFTNGP11.phx.gbl...
BUG: struct default constructor is not displayed on intellisense yet it is
available, BUG

Make a struct type with a parameterized constructor.

Try to construct the type in the IDE and check for the 2 overloads (Default AND the parameterizedone) the default one is NOT displayed thus

giving the FALSE impresison that it DOES NOT exist.

BUG

Jul 21 '05 #2

Well since it can be constructed with

SomeStruct newStruct = new SomeStruct();

I would think that it would have shown this in intellisense. I am aware that
structs only can have theyre own default constructor and you cant override
it, and if you have a parameterized one ALL fields must be set before going
out of scope.

However its the same with classes, here you can just let the system supply
the DEFAULT constructor (like structs .- except theyre by design as system
supplied ONLY) but you still see it in intellisnse.

Its an anoyance.
"Marina" <nospam> wrote in message
news:uM**************@TK2MSFTNGP10.phx.gbl...
A struct always has a default constructor, since structs are value types.
As soon as you declare one, all the fields are initialized - so it is as if you called it, without really having to call it.

You can argue that this is a bug, but it seems like it may have been a
deliberate decision to leave it out, given the behavior of structs.

"news.microsoft.com" <di********@discussion.microsoft.com> wrote in message news:eY*************@TK2MSFTNGP11.phx.gbl...
BUG: struct default constructor is not displayed on intellisense yet it is available, BUG

Make a struct type with a parameterized constructor.

Try to construct the type in the IDE and check for the 2 overloads

(Default
AND the parameterizedone) the default one is NOT displayed thus

giving the FALSE impresison that it DOES NOT exist.

BUG


Jul 21 '05 #3
But there IS a default constructor on structs, its just defined by the
system. Yet intellisense says there is NOT.

Its a BUG, deal with it.

"news.microsoft.com" <di********@discussion.microsoft.com> wrote in message
news:eG**************@tk2msftngp13.phx.gbl...

Well since it can be constructed with

SomeStruct newStruct = new SomeStruct();

I would think that it would have shown this in intellisense. I am aware that structs only can have theyre own default constructor and you cant override
it, and if you have a parameterized one ALL fields must be set before going out of scope.

However its the same with classes, here you can just let the system supply
the DEFAULT constructor (like structs .- except theyre by design as system
supplied ONLY) but you still see it in intellisnse.

Its an anoyance.
"Marina" <nospam> wrote in message
news:uM**************@TK2MSFTNGP10.phx.gbl...
A struct always has a default constructor, since structs are value types.
As soon as you declare one, all the fields are initialized - so it is as if
you called it, without really having to call it.

You can argue that this is a bug, but it seems like it may have been a
deliberate decision to leave it out, given the behavior of structs.

"news.microsoft.com" <di********@discussion.microsoft.com> wrote in

message
news:eY*************@TK2MSFTNGP11.phx.gbl...
BUG: struct default constructor is not displayed on intellisense yet

it is available, BUG

Make a struct type with a parameterized constructor.

Try to construct the type in the IDE and check for the 2 overloads

(Default
AND the parameterizedone) the default one is NOT displayed thus

giving the FALSE impresison that it DOES NOT exist.

BUG



Jul 21 '05 #4

"news.microsoft.com" <di********@discussion.microsoft.com> wrote in message
news:eY*************@TK2MSFTNGP11.phx.gbl...
BUG: struct default constructor is not displayed on intellisense yet it is
available, BUG

Make a struct type with a parameterized constructor.

Try to construct the type in the IDE and check for the 2 overloads (Default AND the parameterizedone) the default one is NOT displayed thus

giving the FALSE impresison that it DOES NOT exist.

BUG

OK, assuming you're talking about C# (I guessed based on one of the groups
you crossposted to), I've replicated the behavior.
Actually, the Microsoft public groups are frequented by Microsoft employees
(implying no official response obligation), so your report has probably been
read already. I'm going to repost the report in a new thread, using a
slightly different approach, and see if a response is forthcoming.

--
Peter - [MVP - Academic]
Jul 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Peter van der Goes | last post by:
When a struct is created in C# and a parameterized constructor defined, the IntelliSense editor shows only the syntax for the parameterized constructor in tooltips, but not for the default...
9
by: Guy | last post by:
I have extended the datetimepicker control to incorporate a ReadOnly property. I have used the new keyword to implement my own version of the value property, so that if readonly == true then it...
4
by: news.microsoft.com | last post by:
BUG: struct default constructor is not displayed on intellisense yet it is available, BUG Make a struct type with a parameterized constructor. Try to construct the type in the IDE and...
4
by: mario.rossi | last post by:
Hi all, I am trying to invoke the default constructor from another, parametrized, constructor, but the default constructor doesn't get invoked at all, I saw. Is this correct ISO C++ behaviour or...
74
by: Zytan | last post by:
I have a struct constructor to initialize all of my private (or public readonly) fields. There still exists the default constructor that sets them all to zero. Is there a way to remove the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.