hi,
we are working on a c++ project which has a lot of thow list
specifications which in the end causes a lot of problems. now i would
like to remove them from the project. because the project has a size of
300000+ lines of code it is not so easy to do all of that manually.
therefore my question: is there a tool that you run on your sources and
which just converts the throw declarations into a comment? a tool that
only comments the declarations would be ideal, because as documentation
the declarations will still be useful.
thanks,
--
Christian Schuhegger http://www.el-chef.de/ 8 1769
"Christian Schuhegger" <Ch************ ******@gmx.de> schreef in bericht
news:cd******** **@sunnews.cern .ch... hi,
we are working on a c++ project which has a lot of thow list specifications which in the end causes a lot of problems. now i would like to remove them from the project. because the project has a size of 300000+ lines of code it is not so easy to do all of that manually.
therefore my question: is there a tool that you run on your sources and which just converts the throw declarations into a comment? a tool that only comments the declarations would be ideal, because as documentation the declarations will still be useful.
thanks,
I don't think it's a lot of work to write that yourself, in case you fail to
find such a tool.
Christian Schuhegger posted: hi,
we are working on a c++ project which has a lot of thow
list specifications which in the end causes a lot of problems.
now i would like to remove them from the project. because the project
has a size of 300000+ lines of code it is not so easy to do all of that
manually. therefore my question: is there a tool that you run on
your sources and which just converts the throw declarations into a
comment? a tool that only comments the declarations would be ideal, because as
documentation the declarations will still be useful.
thanks,
Open an editor. Tools->Replace
Replace "throw"
with "//throw"
-JKop
JKop wrote: Open an editor. Tools->Replace
Replace "throw" with "//throw"
i agree that the problem looks simple, but it is not that simple :)
what do you do if there is a:
void AnyClass::anyMe thod() throw () {
then you comment the { aswell which you don't want to do!
it is also not correct to use a regex to match for (something similar
to:) "throw (.*)", because you could have in your code body something like:
throw (new MyException());
i mean, obviously a task like commenting the throw declarations can be
automised, but it is not as simple as you might think. therefore, before
inventing the wheel again i would prefer to use a tool that somebody
else probably already has written.
--
Christian Schuhegger http://www.el-chef.de/
Christian Schuhegger posted: JKop wrote: Open an editor. Tools->Replace
Replace "throw" with "//throw" i agree that the problem looks simple, but it is not that simple :)
what do you do if there is a: void AnyClass::anyMe thod() throw () { then you comment the { aswell which you don't want to do!
it is also not correct to use a regex to match for (something similar to:) "throw (.*)", because you could have in your code body something like: throw (new MyException());
i mean, obviously a task like commenting the throw declarations can be automised, but it is not as simple as you might think. therefore, before inventing the wheel again i would prefer to use a tool that somebody else probably already has written.
Replace "throw()"
with "/* throw() */"
replace "throw ()"
with "/* throw () */"
Replace "throw ( )"
with "/* throw ( ) */"
template<class T>
void DummyThrow(T) {}
#define throw DummyThrow
-JKop
Make that:
template<class T>
void DummyThrow(cons t T&) {}
-JKop
On Fri, 23 Jul 2004 12:50:51 GMT, JKop <NU**@NULL.NULL > wrote: Christian Schuhegger posted:
JKop wrote: Open an editor. Tools->Replace
Replace "throw" with "//throw" i agree that the problem looks simple, but it is not that simple :)
what do you do if there is a: void AnyClass::anyMe thod() throw () { then you comment the { aswell which you don't want to do!
it is also not correct to use a regex to match for (something similar to:) "throw (.*)", because you could have in your code body something like: throw (new MyException());
i mean, obviously a task like commenting the throw declarations can be automised, but it is not as simple as you might think. therefore, before inventing the wheel again i would prefer to use a tool that somebody else probably already has written.
Replace "throw()" with "/* throw() */"
replace "throw ()" with "/* throw () */"
Replace "throw ( )" with "/* throw ( ) */"
template<cla ss T> void DummyThrow(T) {}
#define throw DummyThrow
What about legitimate uses of throw? E.g.
throw std::runtime_er ror("Something went wrong!");
That will become:
DummyThrow std::runtime_er ror("Something went wrong!");
which is obviously a syntax error.
Tom
First here's some sample code:
#include <stdexcept>
class AnyClass {
public:
void AnyMethod() throw();
};
void AnyClass::AnyMe thod() throw ()
{
throw;
}
int main()
{
AnyClass monkey;
try
{
throw std::runtime_er ror("Something went wrong!");
throw AnyClass();
monkey.AnyMetho d();
}
catch(...)
{
AnyClass ape;
}
}
I'm trying to get the following to work:
class DummyThrow
{
public:
template<class T>
DummyThrow& operator=(const T&) const { return *this; }
};
#define throw() /* z */
#define throw(a) /* z */
#define throw DummyThrow() =
#define try if(1)
#define catch(...) if(0)
But I can't get it to compile.
-JKop
Christian Schuhegger wrote: therefore my question: is there a tool that you run on your sources and which just converts the throw declarations into a comment? a tool that only comments the declarations would be ideal, because as documentation the declarations will still be useful.
the following perl script seems to do the job fine:
-- snip start --
$filename = $ARGV[0];
open(IN,$filena me);
$text = "";
while($line = <IN>) {
$text .= $line;
}
close(IN);
$text =~ s/(throw[ \t\r\n]*\([ \t\r\n]*[A-Za-z_]+(::[A-Za-z_]+)*[
\t\r\n]*(,[ \t\r\n]*[A-Za-z_]+(::[A-Za-z_]+)*[ \t\r\n]*)*\))/\/\* $1 \*\//g;
print $text;
-- snip end --
--
Christian Schuhegger http://www.el-chef.de/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Stan Cook |
last post by:
I was trying to take a list of files in a directory and remove all but the ".dbf" files. I used the following to try to remove the items, but they would not remove. Any help would be greatly appreciated.
x = 0
for each in _dbases:
if each <> ".dbf":
del each # also tried: del _dbases
x = x + 1
I must be doing something wrong, but it acts as though it is....
|
by: Ron_Adam |
last post by:
Hi, Sometimes it just helps to see what's going on, so I've been
trying to write a tool to examine what names are pointing to what
objects in the current scope.
This still has some glitches, like not working in winpython or the
command line, I get a 'stack not deep enough' error. I haven't tested
it on linux yet either. It could be something with my python
install.(?)
Anyway, here's the source with an example output. I'm still not...
|
by: Brynn |
last post by:
I want to thank the person that sent the nasty messages to my
contact.asp test page ... you have inspired me !!!
I have now added a bad_words filter both to my JSValidation script
(going up on my site soon) and my contact.asp tool.
I would have forgotten about it if it were not for you. I TRULY
appreciate your help ... and hope that you helping me eats you up
inside ... ROFL.
|
by: Darren |
last post by:
X-No-Archive
Hi all,
Can anyone help me with structuring the data in a small tool I have to
build? I'm trying to work out if there's a design pattern or data
structure that would remove some of the dependencies.
I am designing an animation tool.
|
by: Oleg Subachev |
last post by:
How to get list of namespces that are declared in an element ?
--
Best regards,
Oleg Subachev
subachev@ural.ru
| |
by: Michael Mair |
last post by:
Hello,
in C89 (at least in the last public draft),
"3.6.2 Compound statement, or block", we have
,---
| Syntax
|
| compound-statement:
| { declaration-list<opt> statement-list<opt> }
|
by: Ron |
last post by:
I've got a listbox that holds a list of groups. Users can
select a group, hit the remove button and the group
should be removed from the listbox. The only problem is
that no matter which group you select, the first one in
the listbox is always removed.(The listitem with an index
of 0. Box is set to single selection mode) I've looked at
multiple examples and they all do it this way. What's
wrong? (variables are also being set to the values...
|
by: Sam Carleton |
last post by:
I am now many months into a project where the powers that be decided to
simply throw static strings in the .Net code. Does anyone know of a
tool that will pull out the strings, and put them into some type of
resource file and ultimately assist us in managing all the strings?
|
by: Zhang Weiwu |
last post by:
Hello. I am looking for a commandline tool to take an html document (or
html document segment, a.k.a. without beginign
"<html><head>..</head><body>") and process it by removing all css style
settings and javascripts, and output a clean html/xhtml.
Optionally, it would be nice if this tool can take an
acceptable tag list and remove all tags not in this list.
I need such a tool to process a lot of static html document I am working
on....
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |