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

const function??

what does this declaration mean?

void function_name() const
{}

This means that the function is constant? what is the implication?

Thanks
Nov 14 '05 #1
10 1517

franco ziade wrote:
what does this declaration mean?

void function_name() const
{}

This means that the function is constant? what is the implication?


It means you have broken code. Did you even try to compile it?

laptop ~ # gcc -Wall -W -O2 -c test.c
test.c: In function `function_name':
test.c:2: error: parse error before '{' token

I mean you might as well ask what

for_lots_of_items (int i = 0 through 3; while i < fourteen; add to i)
display me i please;

means...

Tom

Nov 14 '05 #2
franco ziade <fz****@videotron.ca> wrote:
what does this declaration mean? void function_name() const
{} This means that the function is constant? what is the implication?


Are you sure this is supposed to be C and not C++? If it is C++
then you're in the wrong group, please ask in comp.lang.c++. In
C this function declaration is a syntax error.

Regards, Jens
--
\ Jens Thoms Toerring ___ Je***********@physik.fu-berlin.de
\__________________________ http://www.toerring.de
Nov 14 '05 #3
franco ziade wrote on 25/02/05 :
what does this declaration mean?

void function_name() const
{}


Nothing. Parse error.

--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
The C-library: http://www.dinkumware.com/refxc.html

"Mal nommer les choses c'est ajouter du malheur au
monde." -- Albert Camus.

Nov 14 '05 #4
franco ziade wrote:
what does this declaration mean?
class X {
public: void function_name(void) const { } };
This means that the function is constant? what is the implication?


You are probably reading C++ code.
It looks like a member function definition
taken out of the context of the class definition.
Nov 14 '05 #5
E. Robert Tisdale <E.**************@jpl.nasa.gov> wrote:
franco ziade wrote:
what does this declaration mean?
class X {
public:
void function_name(void) const { }

};

This means that the function is constant? what is the implication?

You are probably reading C++ code.
It looks like a member function definition
taken out of the context of the class definition.


What's going on here? What Franco Ziade wrote was:

|| what does this declaration mean?
||
|| void function_name() const
|| {}
||
|| This means that the function is constant? what is the implication?

What you're "citing" has three lines that never were in the post by
Franco Ziade and of the rest you have "edited" one line. So why are
you (again) "citing" something that has never been posted?
--
\ Jens Thoms Toerring ___ Je***********@physik.fu-berlin.de
\__________________________ http://www.toerring.de
Nov 14 '05 #6
Je***********@physik.fu-berlin.de writes:
E. Robert Tisdale <E.**************@jpl.nasa.gov> wrote:
franco ziade wrote:
what does this declaration mean?

class X {
public:
void function_name(void) const { }

};

This means that the function is constant? what is the implication?

You are probably reading C++ code.
It looks like a member function definition
taken out of the context of the class definition.


What's going on here? What Franco Ziade wrote was:

|| what does this declaration mean?
||
|| void function_name() const
|| {}
||
|| This means that the function is constant? what is the implication?

What you're "citing" has three lines that never were in the post by
Franco Ziade and of the rest you have "edited" one line. So why are
you (again) "citing" something that has never been posted?


If you look carefully, you'll see that ERT correctly marked the lines
he added. In this followup, the OP's line is marked with ">>>", and
the added lines with ">>" (though the original line didn't have the
"{ }" that ERT added to it). He could have been clearer about what he
was doing, though.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #7
Keith Thompson wrote:
Je***********@physik.fu-berlin.de writes:
E. Robert Tisdale <E.**************@jpl.nasa.gov> wrote:
franco ziade wrote: what does this declaration mean?

class X {
public:
void function_name(void) const { }
};

This means that the function is constant? what is the implication?

You are probably reading C++ code.
It looks like a member function definition
taken out of the context of the class definition.


What's going on here? What Franco Ziade wrote was:

|| what does this declaration mean?
||
|| void function_name() const
|| {}
||
|| This means that the function is constant? what is the implication?

What you're "citing" has three lines that never were in the post by
Franco Ziade and of the rest you have "edited" one line. So why are
you (again) "citing" something that has never been posted?


If you look carefully, you'll see that ERT correctly marked the lines
he added. In this followup, the OP's line is marked with ">>>", and
the added lines with ">>" (though the original line didn't have the
"{ }" that ERT added to it). He could have been clearer about what
he was doing, though.


Yes, I was ready to castigate also. However on NS 4.7x quoted
material is in a different typeface than new material, so things
stand out better. I guess ERT does so many trollish things that we
are overly ready to discover another. Every time he shows signs of
reforming he seems to fall off the wagon again. But this is not a
fall :-)

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
Nov 14 '05 #8

"franco ziade" <fz****@videotron.ca> wrote in message
news:N4********************@weber.videotron.net...
what does this declaration mean?

void function_name() const
{}

This means that the function is constant? what is the implication?

Thanks


This means you expect us to read your programming manual for you.
Nov 14 '05 #9
class foo{
public:
void bar();
};
void foo::bar()const{ }
////////////////////////////////////////

const foo a;
a.bar();///////////////////////////

Nov 14 '05 #10
CBFalconer <cb********@yahoo.com> wrote:
Keith Thompson wrote:
Je***********@physik.fu-berlin.de writes:
E. Robert Tisdale <E.**************@jpl.nasa.gov> wrote:
franco ziade wrote:
> what does this declaration mean?
>
class X {
public:
> void function_name(void) const { }
};
>
> This means that the function is constant? what is the implication?

You are probably reading C++ code.
It looks like a member function definition
taken out of the context of the class definition.

What's going on here? What Franco Ziade wrote was:

|| what does this declaration mean?
||
|| void function_name() const
|| {}
||
|| This means that the function is constant? what is the implication?

What you're "citing" has three lines that never were in the post by
Franco Ziade and of the rest you have "edited" one line. So why are
you (again) "citing" something that has never been posted?


If you look carefully, you'll see that ERT correctly marked the lines
he added. In this followup, the OP's line is marked with ">>>", and
the added lines with ">>" (though the original line didn't have the
"{ }" that ERT added to it). He could have been clearer about what
he was doing, though.

Yes, I was ready to castigate also. However on NS 4.7x quoted
material is in a different typeface than new material, so things
stand out better. I guess ERT does so many trollish things that we
are overly ready to discover another. Every time he shows signs of
reforming he seems to fall off the wagon again. But this is not a
fall :-)


Sorry, I apologize to ERT on the count of adding lines. I don't on
the count of editing lines he's citing (there never was a 'void' in
the original post).
Regards, Jens
--
\ Jens Thoms Toerring ___ Je***********@physik.fu-berlin.de
\__________________________ http://www.toerring.de
Nov 14 '05 #11

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

Similar topics

19
by: Christian Engström | last post by:
If you have a function that returns something by value, the gcc compiler (version 3.2.3 on Windows XP with MinGW) converts the returned value from the type you specify in the code, to the const...
2
by: joe | last post by:
hi, after reading some articles and faq, i want to clarify myself what's correct(conform to standard) and what's not? or what should be correct but it isn't simply because compilers don't...
7
by: johny smith | last post by:
Can someone please explain to me the difference between these two: function1( const int a) function2( int const a) Both seemed to compile, but what is the difference between the two above....
7
by: al | last post by:
char s = "This string literal"; or char *s= "This string literal"; Both define a string literal. Both suppose to be read-only and not to be modified according to Standard. And both have...
8
by: Roger Leigh | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 A lot of functions use const pointer arguments. If I have a non-const pointer, it is transparently made const when I pass it to the function, e.g....
8
by: andrew.fabbro | last post by:
In a different newsgroup, I was told that a function I'd written that looked like this: void myfunc (char * somestring_ptr) should instead be void myfunc (const char * somestring_ptr) ...
20
by: Snis Pilbor | last post by:
Whats the point of making functions which take arguments of a form like "const char *x"? It appears that this has no effect on the function actually working and doing its job, ie, if the function...
16
by: hzmonte | last post by:
Correct me if I am wrong, declaring formal parameters of functions as const, if they should not be/is not changed, has 2 benefits; 1. It tells the program that calls this function that the...
4
by: grizggg | last post by:
I have searched and not found an answer to this question. I ran upon the following statement in a *.cpp file in a member function: static const char * const pacz_HTMLContentTypeHeader =...
6
by: .rhavin grobert | last post by:
hello;-) i frequently need the following construction: ReturnParam § Function() § { /...do something.../ someType var § = something; /...do something.../ return something;
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.