473,407 Members | 2,359 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,407 software developers and data experts.

What would this defintion mean: int Function(class CString filename)

Just curious, any one know what the 3 part parameter "class CString
filename" would mean.

The code:
int TestFunc(class CString filename)
{
fopen(filename, "w");
}

Compile using Visaul C++, there is no complain about the defintion. But
the following error:

error C2664: 'fopen' : cannot convert parameter 1 from 'CString' to
'const char *'
Source or target has incomplete type
I know if I remove "class" in parameter list, the function just compile
fine. But what would it mean if I keep "class" there?

Any hint?

Sep 26 '06 #1
4 4719
hu*******@gmail.com wrote:
Just curious, any one know what the 3 part parameter "class CString
filename" would mean.

The code:
int TestFunc(class CString filename)
{
fopen(filename, "w");
}
It means that "CString" is the name of a class - the class of the
"filename" parameter that is passed by value to the implementation of
the function TestFunc().
Compile using Visaul C++, there is no complain about the defintion. But
the following error:

error C2664: 'fopen' : cannot convert parameter 1 from 'CString' to
'const char *'
Source or target has incomplete type
I know if I remove "class" in parameter list, the function just compile
fine. But what would it mean if I keep "class" there?
Are you sure that removing the keyword "class" fixes the compiler
error? It's not impossible, but it would have to mean that "CString" is
not in fact the name of a class as the parameter declaration claims.
Instead CString would have to be the name of a typedef.

Now the error that the compiler reports is it cannot find the
definition of the class CString. And the compiler must have CString's
class definition because filename, a CString parameter, is being passed
by value to TestFunc.

So the upshot is that either the keyword "class" as it is being used
here is either being completely unnecessary or it is being entirely
unhelpful.

Greg

Sep 26 '06 #2

hu*******@gmail.com 写道:
Just curious, any one know what the 3 part parameter "class CString
filename" would mean.

The code:
int TestFunc(class CString filename)
{
fopen(filename, "w");
}

Compile using Visaul C++, there is no complain about the defintion. But
the following error:

error C2664: 'fopen' : cannot convert parameter 1 from 'CString' to
'const char *'
Source or target has incomplete type
I know if I remove "class" in parameter list, the function just compile
fine. But what would it mean if I keep "class" there?

Any hint?

have this kind of function definition?
I think it's grammar error.

-sods

Sep 26 '06 #3
The code is from an old project I am trying to port to VC7.1. Obviously
VC6.0 has no problem with the grammer.

In another similar place. I got a compiler error complaining about
undefined class CString.

This probably has something to do with the change of CString from a
real class definition to a typedef in VC7.1.
Greg wrote:
hu*******@gmail.com wrote:
Just curious, any one know what the 3 part parameter "class CString
filename" would mean.

The code:
int TestFunc(class CString filename)
{
fopen(filename, "w");
}

It means that "CString" is the name of a class - the class of the
"filename" parameter that is passed by value to the implementation of
the function TestFunc().
Compile using Visaul C++, there is no complain about the defintion. But
the following error:

error C2664: 'fopen' : cannot convert parameter 1 from 'CString' to
'const char *'
Source or target has incomplete type
I know if I remove "class" in parameter list, the function just compile
fine. But what would it mean if I keep "class" there?

Are you sure that removing the keyword "class" fixes the compiler
error? It's not impossible, but it would have to mean that "CString" is
not in fact the name of a class as the parameter declaration claims.
Instead CString would have to be the name of a typedef.

Now the error that the compiler reports is it cannot find the
definition of the class CString. And the compiler must have CString's
class definition because filename, a CString parameter, is being passed
by value to TestFunc.

So the upshot is that either the keyword "class" as it is being used
here is either being completely unnecessary or it is being entirely
unhelpful.

Greg
Oct 2 '06 #4
I think it probably has something to do with the fact that VC 6.0 is
notorious for not following the current standard. 7.1 much closly follows
the standard.

<hu*******@gmail.comwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
The code is from an old project I am trying to port to VC7.1. Obviously
VC6.0 has no problem with the grammer.

In another similar place. I got a compiler error complaining about
undefined class CString.

This probably has something to do with the change of CString from a
real class definition to a typedef in VC7.1.
Greg wrote:
>hu*******@gmail.com wrote:
Just curious, any one know what the 3 part parameter "class CString
filename" would mean.

The code:
int TestFunc(class CString filename)
{
fopen(filename, "w");
}

It means that "CString" is the name of a class - the class of the
"filename" parameter that is passed by value to the implementation of
the function TestFunc().
Compile using Visaul C++, there is no complain about the defintion. But
the following error:

error C2664: 'fopen' : cannot convert parameter 1 from 'CString' to
'const char *'
Source or target has incomplete type
I know if I remove "class" in parameter list, the function just compile
fine. But what would it mean if I keep "class" there?

Are you sure that removing the keyword "class" fixes the compiler
error? It's not impossible, but it would have to mean that "CString" is
not in fact the name of a class as the parameter declaration claims.
Instead CString would have to be the name of a typedef.

Now the error that the compiler reports is it cannot find the
definition of the class CString. And the compiler must have CString's
class definition because filename, a CString parameter, is being passed
by value to TestFunc.

So the upshot is that either the keyword "class" as it is being used
here is either being completely unnecessary or it is being entirely
unhelpful.

Greg

Oct 2 '06 #5

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

Similar topics

7
by: Ben Amada | last post by:
I've created a class that I need to store in ViewState. However when I try to store it in ViewState, I get the following error: "The type 'solution.pe2' must be marked as Serializable or have a...
0
by: martin | last post by:
Hello, I have raw XML that I want to package as a SOAP message and send over HTTP to some web service end-point. Later on I'm gonna need it to be wrapped into a SSL tunnel too, with full...
4
by: C# | last post by:
hi what class can seize http request in .NET framework or c#? thinks!!
2
by: ad | last post by:
I use a pre-defined CSS to my webpage. There are many class in the CSS. The header of my GridView will be affected by the CSS, but I can't find the class which affect the header of the GridView. ...
3
by: Ron | last post by:
I am writing a very simple program, three buttons NORMAL, SMILE, FROWN. When the appropriate button is clicked a label either pops up a smile, frown or a normal face. I wrote a class to do this....
3
by: antred | last post by:
Hello everyone, While working on a program I encountered a situation where I'd construct a largish data structure (a tree) from parsing a host of files and would end up having to throw away...
4
by: desktop | last post by:
I found this class at: http://www.icce.rug.nl/documents/cplusplus/cplusplus17.html#FINDEND class Twice { public: bool operator()(size_t first, size_t second) const { return first ==...
14
by: gggram2000 | last post by:
Can anyone tell me if this class will function properly...I'm using MS Visual Studio 2005, using C#. I notice there's no C# forum but hopefully u guys are familiar with the language...thanks in...
4
by: Gilbert Tordeur | last post by:
Hello, My program is creating pdf files, around 50 - 100 kB each. Today I write them in text files, then read them back to store into a database. It's obvious for me that I can save the text...
16
by: John Doe | last post by:
Hi, I wrote a small class to enumerate available networks on a smartphone : class CNetwork { public: CNetwork() {}; CNetwork(CString& netName, GUID netguid): _netname(netName),...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...

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.