473,395 Members | 1,418 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,395 software developers and data experts.

Weeired compile issue

I have a property in my class like..

Int32 iVal;

public String Val
{
get{return iVal;}
set{this.iVal = value;}
}

Strange that compiler does not pick it up as error because of type mismatch.
Jan 13 '06 #1
4 1159

"Winista" <na*********@hotmail.com> wrote in message
news:ev**************@TK2MSFTNGP09.phx.gbl...
|I have a property in my class like..
|
| Int32 iVal;
|
| public String Val
| {
| get{return iVal;}
| set{this.iVal = value;}
| }
|
| Strange that compiler does not pick it up as error because of type
mismatch.
|
|

Are you sure you are compiling this piece of code? The compiler should throw
an error message.

Willy.
Jan 13 '06 #2
Winista <na*********@hotmail.com> wrote:
I have a property in my class like..

Int32 iVal;

public String Val
{
get{return iVal;}
set{this.iVal = value;}
}

Strange that compiler does not pick it up as error because of type mismatch.


Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

The above certainly doesn't compile on my box...

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jan 13 '06 #3
The kicker is that if I create a small project to reproduce this issue the
compiler does pick up the issue. But in a large project, this problem shows
up. Unfortunately I can't send the whole project. I will try to narrow it
down to specific pattern and then post the code.

Thanks for asking for program for reproducing the issue.

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Winista <na*********@hotmail.com> wrote:
I have a property in my class like..

Int32 iVal;

public String Val
{
get{return iVal;}
set{this.iVal = value;}
}

Strange that compiler does not pick it up as error because of type
mismatch.


Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

The above certainly doesn't compile on my box...

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

Jan 16 '06 #4
"Winista" <na*********@hotmail.com> wrote in message
news:#R**************@TK2MSFTNGP14.phx.gbl...
Thanks for asking for program for reproducing the issue.


Why do you think we do it? Half the time, the original poster finds the
error right then.

--
Truth,
James Curran
[erstwhile VC++ MVP]

Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
Jan 16 '06 #5

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

Similar topics

0
by: Rick Blythin | last post by:
I'm a volunteer computer tech for an on-line support website. The following is an except of one case that the original tech who took it can't resolve client wrote: " I have installed JDK1.2 in...
2
by: Brian | last post by:
I am having a problem with namespace resolution. Example is below: Namespace MyNamespace Public Class MyClass public x as System.String end class end namespace I get the following compile...
2
by: Dav Tan | last post by:
Hi, When I try to build my solution, in the output window, it shows: "Performing main compilation..." and then it just hang. But if I compile a smaller solution, it works fine. Any idea of what...
8
by: farseer | last post by:
Can someone please assist me in understanding why i am receiving this error: " error C2440: 'type cast' : cannot convert from 'LRESULT (__cdecl CMyToday::* )(HWND,UINT,WPARAM,LPARAM)' to 'LONG' "...
8
by: Mark | last post by:
Hi, I have two classes: template <class Resourceclass GuardBase { protected : Resource& fResource; bool fAcquired;
1
by: jeet232 | last post by:
I've few cpp files which i'm trying to compile. when i try with g++ -c *.cpp everything goes fine, no errors. but when i try g++ *.cpp it gives me errors about various declarations of...
6
by: Ed Leafe | last post by:
I've noticed an odd behavior with compile() and code that does not contain a trailing newline: if the last line is a comment inside of any block, a syntax error is thrown, but if the last line is a...
1
by: sevak316 | last post by:
I have a project in Visual Studio 2008 which includes both .c and .cpp files. I have no problem compiling the .cpp file. However, there is a problem in the header of a .cpp file. In the header I...
3
by: Hill | last post by:
This is an simple map, just an exercise. Who can help me fix this compile issue?Thanks in advance. #include <string> #include <vector> #include <iostream> using std::vector; using std::string;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
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...

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.