473,964 Members | 16,540 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 parameterizedon e) the default one is NOT displayed thus

giving the FALSE impresison that it DOES NOT exist.

BUG
Jul 21 '05 #1
4 1423
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********@dis cussion.microso ft.com> wrote in message
news:eY******** *****@TK2MSFTNG P11.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 parameterizedon e) 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******** ******@TK2MSFTN GP10.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********@dis cussion.microso ft.com> wrote in message news:eY******** *****@TK2MSFTNG P11.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 parameterizedon e) 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********@dis cussion.microso ft.com> wrote in message
news:eG******** ******@tk2msftn gp13.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******** ******@TK2MSFTN GP10.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********@dis cussion.microso ft.com> wrote in

message
news:eY******** *****@TK2MSFTNG P11.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 parameterizedon e) 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********@dis cussion.microso ft.com> wrote in message
news:eY******** *****@TK2MSFTNG P11.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 parameterizedon e) 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
2132
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 constructor which appears to still exist. If this is not designed behavior, is it a bug or am I misusing my struct? If it is by design, could you please explain? I realize the behavior of a struct, as regards constructors, is different from that of...
9
3991
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 will not set the value of the control and will leave the checked status of the checkbox to false when a user selects a new date. this works fine when using the control on a win2k machine but if we use it on a win XP box and call
4
1073
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 check for the 2 overloads (Default AND the parameterizedone) the default one is NOT displayed thus
4
1750
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 my compiler has a ++bug (overflowing)? struct Test { int x; int y; // Test() {
74
16120
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 creation of this implicit default constructor, to force the creation of a struct via my constructor only? Zytan
0
10130
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11780
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10851
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
8420
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7567
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6506
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
5107
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4694
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3720
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.