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

deprecation of older C routines

Hello,

I was wondering if anyone has some suggestions on how to deprecate C
routines from a n already released API. I would like to be able to do
this via the gcc compiler and be warn the end developers of the new
routine to use if possible.
Thanks,

Sean

Nov 15 '05 #1
7 1247
Te*********@charter.net wrote:
Hello,

I was wondering if anyone has some suggestions on how to deprecate C
routines from a n already released API. I would like to be able to do
this via the gcc compiler and be warn the end developers of the new
routine to use if possible.
Thanks,

Sean


It is rather OT, however what do you want to do? I think you can't do
this without releasing a new version of the library, that has the
necessary recommendations...

__attribute__((__deprecated__)) void a(void) {
}

int main(void) {
a();
return 0;
}

--
one's freedom stops where other's begin

Giannis Papadopoulos
http://dop.users.uth.gr/
University of Thessaly
Computer & Communications Engineering dept.
Nov 15 '05 #2
Giannis Papadopoulos wrote:
Te*********@charter.net wrote:
Hello,

I was wondering if anyone has some suggestions on how to deprecate C
routines from a n already released API. I would like to be able to do
this via the gcc compiler and be warn the end developers of the new
routine to use if possible.
Thanks,

Sean


It is rather OT, however what do you want to do? I think you can't do
this without releasing a new version of the library, that has the
necessary recommendations...

__attribute__((__deprecated__)) void a(void) {
}

int main(void) {
a();
return 0;
}


Of course, this certainly works on gcc and does not necessarily work on
other compilers...

--
one's freedom stops where other's begin

Giannis Papadopoulos
http://dop.users.uth.gr/
University of Thessaly
Computer & Communications Engineering dept.
Nov 15 '05 #3
Te*********@charter.net wrote:

Hello,

I was wondering if anyone has some suggestions on how to deprecate C
routines from a n already released API. I would like to be able to do
this via the gcc compiler and be warn the end developers of the new
routine to use if possible.


This is OT to c.l.c, as it is specific to the gcc compiler and not C
itself, but check the gcc docs for the function attribute "deprecated".

Beyond that, there may be a gcc-specific newsgroup, should you need more
help.

--
+-------------------------+--------------------+-----------------------------+
| Kenneth J. Brody | www.hvcomputer.com | |
| kenbrody/at\spamcop.net | www.fptech.com | #include <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------------+
Don't e-mail me at: <mailto:Th*************@gmail.com>

Nov 15 '05 #4
Te*********@charter.net wrote on 02/08/05 :
Hello,

I was wondering if anyone has some suggestions on how to deprecate C
routines from a n already released API. I would like to be able to do
this via the gcc compiler and be warn the end developers of the new
routine to use if possible.

Thanks,

Sean


AFAICT, there is no standard solution. Some compilers have a
'__deprecated__ keyword, others have a #warning directive...

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

"C is a sharp tool"
Nov 15 '05 #5
In article <11**********************@g43g2000cwa.googlegroups .com>,
<Te*********@charter.net> wrote:

I was wondering if anyone has some suggestions on how to deprecate C
routines from a n already released API. I would like to be able to do
this via the gcc compiler and be warn the end developers of the new
routine to use if possible.


There are several ways of dealing with this.

Plain old text:

if (! nag_inhibit_for_version_1_0)
{
printf("* You are using an old version of this API function\n");
printf("* The new version is called Blah_Blah()\n");
printf("* Set 'nag_inhibit_for_version_1_0' to non-zero to\n");
printf(" prevent this message from appearing when using the\n");
printf(" old blabla() functionality\n");
printf("* Support for blabla() will be removed on Apr 01 2007\n");
nag_inhibit_for_version_1_0 = 1;
}

A more friendly way would be to document the change and notify
your customers/users through actual communication. Perhaps
send out letters and announcements to paying customers or post
to a developer email list if it's GPL or freeware.

When possible, I like to keep the old interface around, but
just have it make calls to the new functions. Obviously
this is not possible if the interface changes drastically.

If your API is implemented using a library or DLL you
may be able to use versioning or the file name itself to
force the end developer to pay attention to the API change.
--
7842++
Nov 15 '05 #6
Te*********@charter.net writes:
I was wondering if anyone has some suggestions on how to deprecate C
routines from a n already released API. I would like to be able to do
this via the gcc compiler and be warn the end developers of the new
routine to use if possible.


There's no portable way to trigger a warning on a call to a specified
function.

There might be a gcc-specific way to do it. If so, it should be
documented in the extensive documentation that comes with gcc (try
"info gcc"); failing that, try gnu.gcc.help.

<OT>Hint: Search for "deprecated" in the gcc documentation, and be
prepared to skip over the first few occurrences.</OT>

--
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 15 '05 #7

<Te*********@charter.net> wrote

I was wondering if anyone has some suggestions on how to deprecate C
routines from a n already released API. I would like to be able to do
this via the gcc compiler and be warn the end developers of the new
routine to use if possible.

#ifdef DEPRECATION
#error This file has been deprecated
#endif

Unfortunately it only works for whole source files. You can however guard a
function

#ifndef DEPRECATION

int deprecatedfunction(int x, int y)
{
return x == y ? x + 2 : x > y ? x + 1 : y + 1;
}
#endif
Nov 15 '05 #8

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

Similar topics

46
by: Robin Becker | last post by:
It seems that the rotor module is being deprecated in 2.3, but there doesn't seem to be an obvious alternative. I'm using it just for obfuscation. It seems we have ssl available in 2.3 for sockets,...
12
by: zhi | last post by:
Really confused, when I use keyword style argument as following: >>> input(prompt="hello") Traceback (most recent call last): File "<pyshell#52>", line 1, in -toplevel- input(prompt="hello")...
185
by: Martin Jørgensen | last post by:
Hi, Consider: ------------ char stringinput ..bla. bla. bla. do {
1
by: psreddy71 | last post by:
i am trying to solve deprecation warning problem from past days.can any body help me please ? i am getting deprecation warning at method .can any body compile this program under jdk1.5 and...
4
by: Anoop | last post by:
Hi All, I am getting the following error while trying to use deprecation Please help 'a.b.mpilgrim.z' Traceback (most recent call last): File "<interactive input>", line 1, in ?...
9
by: david.dynamicconcepts | last post by:
Now that Microsoft has deprecated many of the str.???(...) functions, and an increasing number of development shops and Business Software Development Groups are trying to eliminate these routines...
4
by: JShrager | last post by:
I just upgraded my server to a recent version of redhat, and now old code no longer compiles. I'm not a C++ coder, but C++ coders who use my server are now complaining. Here's an example: ...
1
by: Gennaro Prota | last post by:
James Kanze wrote: I see. You imply that, in theory, it couldn't be canceled? Or that it would require some long workflow? Yes, I know the etymology (BTW, terms of direct Latin derivation...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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 project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.