Hi,
all is going fine, but I'm compiling with max warnings, and I get a lot of
warnings to tell me that some parameter passed is not being used. Is there a
way of telling the compiler that its ok? eg pointers i can do:
if( pIn) ;
then i don't get the complaint (something else instead ;-) )but I could do
with something like:
void func(int i1,int i2, int i3)
{
#pragma NOTUSED (i1,i2)
printf("%d",i3)
}
Sorry if its compiler specific.
Mike 9 6423
"Michael" <sl***********@hotmail.com> wrote in message
news:cn**********@sparta.btinternet.com... all is going fine, but I'm compiling with max warnings, and I get a lot of warnings to tell me that some parameter passed is not being used. Is there a way of telling the compiler that its ok? eg pointers i can do: if( pIn) ; then i don't get the complaint (something else instead ;-) )but I could do with something like:
void func(int i1,int i2, int i3) { #pragma NOTUSED (i1,i2)
printf("%d",i3) }
It depends on your compiler, of course, but as a general notion it would
seem that if you aren't using a parameter, you shouldn't be giving it a
name:
void func(int, int, int i3)
{
// etc.
}
In article <cn**********@sparta.btinternet.com>,
Michael <sl***********@hotmail.com> wrote: Hi, all is going fine, but I'm compiling with max warnings, and I get a lot of warnings to tell me that some parameter passed is not being used. Is there a way of telling the compiler that its ok? eg pointers i can do: if( pIn) ; then i don't get the complaint (something else instead ;-) )but I could do with something like:
void func(int i1,int i2, int i3) { #pragma NOTUSED (i1,i2)
printf("%d",i3) }
Isn't this what unnamed parameters are for?
void func(int,int,int i3)
{
printf("%d",i3);
}
dave
--
Dave Vandervies dj******@csclub.uwaterloo.ca
Perhaps the original version of the program worked.
OK, this takes us *way* off topic for any computer related newsgroup, but
you've got to admit its a theoretical possibility. --Ken Hagan in comp.arch
Michael wrote : Hi, all is going fine, but I'm compiling with max warnings, and I get a lot of warnings to tell me that some parameter passed is not being used. Is there a way of telling the compiler that its ok? eg pointers i can do: if( pIn) ; then i don't get the complaint (something else instead ;-) )but I could do with something like:
void func(int i1,int i2, int i3) { #pragma NOTUSED (i1,i2)
printf("%d",i3) }
#define NOTUSED(_V) ((void) (_V))
void func(int i1,int i2, int i3)
{
NOTUSED(i1);
NOTUSED(i2);
printf("%d",i3)
}
(follow up to comp.lang.c)
--
Maxim
"Amour de putain feu d'estoupe."
- proverbe françois
In article <mn.80c77d4b3dc842e6.20219@bboy>,
Maxim <bo*****************@gmail.com> wrote: #define NOTUSED(_V) ((void) (_V))
void func(int i1,int i2, int i3) { NOTUSED(i1); NOTUSED(i2); printf("%d",i3) }
(follow up to comp.lang.c)
Wouldn't it make more sense to give a C++ answer and leave the thread
in clc++?
If the OP wanted a C answer, he'd've posted in comp.lang.c in the first
place, no?
And even assuming that he really wanted a C answer, your solution isn't
valid, since it uses an identifier reserved for the implementation
(see n869 7.1.3).
dave
--
Dave Vandervies dj******@csclub.uwaterloo.ca
Perhaps the original version of the program worked.
OK, this takes us *way* off topic for any computer related newsgroup, but
you've got to admit its a theoretical possibility. --Ken Hagan in comp.arch
>It depends on your compiler, of course, but as a general notion it would seem that if you aren't using a parameter, you shouldn't be giving it a name:
If a parameter is unnamed, and presumably therefore unusable, can the compiler
eliminate the passing of the argument to the function?
DaKoadMunky wrote: It depends on your compiler, of course, but as a general notion it would seem that if you aren't using a parameter, you shouldn't be giving it a name:
If a parameter is unnamed, and presumably therefore unusable, can the compiler eliminate the passing of the argument to the function?
probably not since the prototype can have unnamed parameters in either case...
David
Thanks guys, that was exactly what i was after.
Mike
"David Lindauer" <ca*****@bluegrass.net> wrote in message
news:41**************@bluegrass.net...
DaKoadMunky wrote:
It depends on your compiler, of course, but as a general notion it
wouldseem that if you aren't using a parameter, you shouldn't be giving it a name: If a parameter is unnamed, and presumably therefore unusable, can the
compiler eliminate the passing of the argument to the function?
probably not since the prototype can have unnamed parameters in either
case... David
"Michael" <sl***********@hotmail.com> wrote in message
news:cn**********@sparta.btinternet.com... Hi, all is going fine, but I'm compiling with max warnings, and I get a lot of warnings to tell me that some parameter passed is not being used. Is there a way of telling the compiler that its ok? eg pointers i can do: if( pIn) ; then i don't get the complaint (something else instead ;-) )but I could do with something like:
void func(int i1,int i2, int i3) { #pragma NOTUSED (i1,i2)
printf("%d",i3) }
Sorry if its compiler specific.
Mike
Just an FYI: besides using unnamed parameters, you can also do this:
void func( int i1, int i2, int i3 )
{
i1;
i2;
printf("%d",i3);
}
-Howard dj******@csclub.uwaterloo.ca (Dave Vandervies) wrote: #define NOTUSED(_V) ((void) (_V))
void func(int i1,int i2, int i3) { NOTUSED(i1); NOTUSED(i2); printf("%d",i3) }
If the OP wanted a C answer, he'd've posted in comp.lang.c in the first place, no?
This answer works in both C and C++ (in C you cannot have unnamed
parameters).
(For some definitions of "works", one compiler I use will still
issue the warning for this form of NOTUSED).
And even assuming that he really wanted a C answer, your solution isn't valid, since it uses an identifier reserved for the implementation (see n869 7.1.3).
I don't think preprocessor tokens are identifiers. In the
preprocessed output, _V will not appear. If there is already
a _V defined, then it will be superseded by the new _V for the
scope of the macro definition.
For example I could go:
#include <stdio.h>
#define BAR(NULL)
BAR(a)
just fine. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Chuck Martin |
last post by:
I am having a most frustrating problem that references, web searches,
and other resources are no help so far in solving. Basically, I'm trying
to design a pop-up window to be called with a funciton...
|
by: Steve Jorgensen |
last post by:
Hi all,
I had just participating in a small thread here about when to set recordset
variables to Nothing when I ran into an interesting case in my own code that
highlighted the need for a...
|
by: Gerry Abbott |
last post by:
Hi All,
Im trying to use thie combination but have not had success. Below is the
function
It tried the following
myriskLevel(2,2)
myrisklevel(0,0,2)
and the ismissing(Three) alwasy...
|
by: Jozef |
last post by:
Hello,
I'm trying to create a central function that runs a connection to an SQL
Server database. The connection etc works, but when I try to call it, I get
an error saying "Runtime-Error 91:...
|
by: Tweaxor |
last post by:
Hey,
I was trying to figure out was it possible in C to pass the values in an array
from one function to another function. Is the possible in C?
ex. y is the array that holds seven values
If...
|
by: Brian Pittman |
last post by:
Hi,
I was wondering how to go about creating a wrapper function for uploading
files to the server? I have made an attempt on my own without success. I
don't get any exceptions from the...
|
by: Mark Kamoski |
last post by:
Hi Everyone.
Please help.
Is there a way to return void from a Function?
That is, what are the ramifications of writing something like the
following...
|
by: Paul |
last post by:
Anyone have code that emulates the Nz function in Microsoft Access?
In Access it is:
Nz(Value as variant, Optional ValueIfNull as Variant) as Variant
|
by: momo |
last post by:
Hello to all,
I need some help. I am looking for a database connection function that I can
use in my ASP.NET site. This would be in VB.NET. What I want to be able to
do is call the function and...
|
by: Ivor Somerset |
last post by:
Hello,
In my ASP code I sometimes write functions that return an object
(generally an XML node).
Such a function is invoked this way:
Set Object1 = MyFunction(SomeValue)
And at the end of...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
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...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
| |