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

about gcc 4.2

The following conflict is of importance to my work here. with porting
happening in gcc4.2 from gcc3.4 we have to
do the following
# (void *)printf() should be (void)printf()

Can anybody explain the rational behind the same.
-Parag

Oct 22 '07 #1
6 1400
pa********@hotmail.com said:
The following conflict is of importance to my work here. with porting
happening in gcc4.2 from gcc3.4 we have to
do the following
# (void *)printf() should be (void)printf()
Remove the cast in both cases. This is nothing to do with gcc (which is
just as well, as it would have been off-topic otherwise), and everything
to do with people adding stupid pointless casts that damage the
readability of the code.
Can anybody explain the rational behind the same.
There isn't one. Just rip the casts out. They're ridiculous.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Oct 22 '07 #2
but what could have been the point in adding the casts.
Do you think the user might have had a good reason for it.
Sorry if the discussion is hitting the wall on this!
-Parag

Oct 22 '07 #3
pa********@hotmail.com wrote:
The following conflict is of importance to my work here. with porting
happening in gcc4.2 from gcc3.4 we have to
do the following
# (void *)printf() should be (void)printf()

Can anybody explain the rational behind the same.
The (void*) cast serves no useful purpose. On the other hand, the (void)
cast disables the warning message that some compilers and code checkers
generate which complains about the fact that you're not using the return
value from the function. I prefer to disable that feature of the
compiler, instead. If it can't be turned off, I'd use a different
compiler. However, sometimes that's not a feasible option.

Oct 22 '07 #4
pa********@hotmail.com said:
but what could have been the point in adding the casts.
Shutting up a bad lint.
Do you think the user might have had a good reason for it.
Reason, yes. Good reason, no.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Oct 22 '07 #5
On Mon, 22 Oct 2007 11:52:21 +0000, Richard Heathfield
<rj*@see.sig.invalidwrote:
>pa********@hotmail.com said:
>but what could have been the point in adding the casts.

Shutting up a bad lint.
And it should be noted that the good lints allow you to suppress this
warning on a per-function basis, using a configuration file setting,
without having to modify your source code. For example:

-esym(534,memset, strcat, strcpy, fprintf, sprintf, memcpy, printf,
fgets, sscanf, fflush, vsprintf)

Caution should be exercised to only use Standard C functions in such a
setting.

Best regards
--
jay
Oct 23 '07 #6
"jaysome" <ja*****@hotmail.coma écrit dans le message de news:
ff********************************@4ax.com...
On Mon, 22 Oct 2007 11:52:21 +0000, Richard Heathfield
<rj*@see.sig.invalidwrote:
>>pa********@hotmail.com said:
>>but what could have been the point in adding the casts.

Shutting up a bad lint.

And it should be noted that the good lints allow you to suppress this
warning on a per-function basis, using a configuration file setting,
without having to modify your source code. For example:

-esym(534,memset, strcat, strcpy, fprintf, sprintf, memcpy, printf,
fgets, sscanf, fflush, vsprintf)
While I agree that the return values of most of these functions can be
safely ignored,
- sprintf should be deprecated in favor of snprintf,
- sscanf (and other scanf) return value should *not* be ignored.
Caution should be exercised to only use Standard C functions in such a
setting.
What is wrong with adding locally functions defined for which the warning is
not useful ?
This configuration file should be customized on a project basis.

--
Chqrlie.
Oct 23 '07 #7

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

Similar topics

1
by: eScrewDotCom | last post by:
eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is very funny. eScrew...
220
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have...
8
by: eScrewDotCom | last post by:
eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is very funny. eScrew...
77
by: nospam | last post by:
Reasons for a 3-tier achitecture for the WEB? (NOTE: I said, WEB, NOT WINDOWS. DON'T shoot your mouth off if you don't understand the difference.) I hear only one reason and that's to switch a...
125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
5
by: eScrewDotCom | last post by:
www.eScrew.com eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is...
81
by: Matt | last post by:
I have 2 questions: 1. strlen returns an unsigned (size_t) quantity. Why is an unsigned value more approprate than a signed value? Why is unsighned value less appropriate? 2. Would there...
0
by: eScrewDotCom | last post by:
eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is very funny. eScrew...
7
by: Edward Yang | last post by:
A few days ago I started a thread "I think C# is forcing us to write more (redundant) code" and got many replies (more than what I had expected). But after reading all the replies I think my...
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?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...

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.