There are some blocks of C/C++ code put under
#if 0
#end if
Is there anyway to make the code inside these blocks to get executed
(may be by using some command line options)?
I am using SUN compiler. 10 54538
qazmlp wrote: There are some blocks of C/C++ code put under #if 0
#end if
Is there anyway to make the code inside these blocks to get executed (may be by using some command line options)?
I am using SUN compiler.
No. While it is there the enclosed code will be ignored by the compiler,
so there is nothing in the executable to execute. To run the code you
will have to recompile the program without the "#if 0", or after
changing it to something like "#if 01".
John Howells
In article <db*************************@posting.google.com> ,
qazmlp <qa********@rediffmail.com> wrote: There are some blocks of C/C++ code put under #if 0
#end if
Is there anyway to make the code inside these blocks to get executed (may be by using some command line options)?
Why did you use "#if 0" if you meant for it to be an option you could
select at compile time? Change it to something like:
#if DEBUGGING
....
#endif
and then you can use -DDEBUGGING=1 when compiling to enable that block.
--
Barry Margolin, ba************@level3.com
Level(3), Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
On Fri, 11 Jul 2003 16:21:04 +0200, Barry Margolin wrote: In article <db*************************@posting.google.com> , qazmlp <qa********@rediffmail.com> wrote:There are some blocks of C/C++ code put under #if 0
#end if
Is there anyway to make the code inside these blocks to get executed (may be by using some command line options)?
Why did you use "#if 0" if you meant for it to be an option you could select at compile time? Change it to something like:
#if DEBUGGING ... #endif
and then you can use -DDEBUGGING=1 when compiling to enable that block.
That's a good thing, you even can go further and use
use the symbol NDEBUG as used by the assert macro calls.
In a final/production build, -DNDEBUG is set.
In article <3F***************@sun.com>,
Eric Sosman <Er*********@Sun.COM> wrote: qazmlp wrote: There are some blocks of C/C++ code put under #if 0
#end if
Is there anyway to make the code inside these blocks to get executed (may be by using some command line options)?
I am using SUN compiler.
tr 0 1 <original.c >tmp.c mv tmp.c original.c cc original.c
... and then debug ;-)
Because you need to find all the other funny places where a '0' has been
replaced by a '1' ;-)
--
EMail:jo***@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin js@cs.tu-berlin.de (uni) If you don't have iso-8859-1 sc*******@fokus.fraunhofer.de (work) chars I am J"org Schilling
URL: http://www.fokus.fraunhofer.de/usr/schilling ftp://ftp.berlios.de/pub/schily
On Fri, 11 Jul 2003 03:47:15 -0700, qazmlp wrote: There are some blocks of C/C++ code put under #if 0
#end if
Is there anyway to make the code inside these blocks to get executed (may be by using some command line options)?
Change the #if 0 to #if 1
--
Freenet distribution not available
Grelb's Reminder:
Eighty percent of all people consider themselves to be above
average drivers.
Eric Sosman wrote: qazmlp wrote: There are some blocks of C/C++ code put under #if 0
#end if
Is there anyway to make the code inside these blocks to get executed (may be by using some command line options)?
I am using SUN compiler. tr 0 1 <original.c >tmp.c
Appologies if this is getting too OT, but if you REALLY want to go this route,
then use this translation instead:
sed '/#if/s/0/1/' original.c > tmp.c
so you only translate the zeros on the "#if" lines rather than everywhere in
your program, then do a quick "diff" (or tkdiff if available) on the 2 files to
check the differences before compiling. I'd also keep a backup of original.c
before starting this process!
Ed.
mv tmp.c original.c cc original.c
... and then debug ;-)
(In other words, no. The compiler is obeying your orders, and cannot be persuaded to disobey.)
-- Er*********@sun.com
In 'comp.lang.c', qa********@rediffmail.com (qazmlp) wrote: There are some blocks of C/C++ code put under #if 0
#end if
Is there anyway to make the code inside these blocks to get executed (may be by using some command line options)?
The question is not to be /executed/ of not, but to be *compiled* or not.
The #if 0 trick is used to uncomment easily one or several lines of code.
You could also use a more clever trick that is
#ifndef DBG
#define DBG 0 /* 0 | 1 */
#endif
<...>
#if DBG
/* code to be commented out (or not) */
#endif
Now, some compilers allows you to define a macro on the command line.
Say ...
-DDBG=1
or
-DDBG=0
.... according to your needs.
I often use this trick on embedded systems to reduce the size of some library
code when parts of it are not used.
--
-ed- em**********@noos.fr [remove YOURBRA before answering me]
The C-language FAQ: http://www.eskimo.com/~scs/C-faq/top.html
<blank line>
FAQ de f.c.l.c : http://www.isty-info.uvsq.fr/~rumeau/fclc/
In 'comp.lang.c', Zoran Cutura <zo**********@daimlerchrysler.com> wrote: That's a good thing, you even can go further and use use the symbol NDEBUG as used by the assert macro calls. In a final/production build, -DNDEBUG is set.
I wouldn't, because obviously this code and assertions are not meant to be included at the same time.
Actually I'ld probably never use NDEBUG in my code, because this IMHO as an option from the standard library should only be used for the standard library.
I don't see why. It often happens that I insert assert() in my code as design
checker, and I'm glad to have it automatically commented out at release time
(final target code). Using assert() implies an implicit use of NDEBUG.
--
-ed- em**********@noos.fr [remove YOURBRA before answering me]
The C-language FAQ: http://www.eskimo.com/~scs/C-faq/top.html
<blank line>
FAQ de f.c.l.c : http://www.isty-info.uvsq.fr/~rumeau/fclc/
In comp.lang.c Emmanuel Delahaye <em**********@noos.fr> wrote: In 'comp.lang.c', Zoran Cutura <zo**********@daimlerchrysler.com> wrote:
That's a good thing, you even can go further and use use the symbol NDEBUG as used by the assert macro calls. In a final/production build, -DNDEBUG is set.
I wouldn't, because obviously this code and assertions are not meant to be included at the same time.
Actually I'ld probably never use NDEBUG in my code, because this IMHO as an option from the standard library should only be used for the standard library.
I don't see why. It often happens that I insert assert() in my code as design checker, and I'm glad to have it automatically commented out at release time (final target code). Using assert() implies an implicit use of NDEBUG.
You're talking about the implicit usage of NDEBUG? Me not. I mean I
don't do
#ifndef NDEBUG
/* code */
#endif
or
#if !defined NDEBUG
#endif
because I want to be able switch my code on or off separately from
assertions.
--
Z (Zo**********@daimlerchrysler.com)
"LISP is worth learning for the profound enlightenment experience
you will have when you finally get it; that experience will make you
a better programmer for the rest of your days." -- Eric S. Raymond
Zoran Cutura wrote: In comp.lang.c Emmanuel Delahaye <em**********@noos.fr> wrote:
Using assert() implies an implicit use of NDEBUG.
Using assert() implies a use of NDEBUG.
Using assert() is an implicit use of NDEBUG.
You're talking about the implicit usage of NDEBUG? Me not. I mean I don't do
#ifndef NDEBUG /* code */ #endif
or
#if !defined NDEBUG #endif
because I want to be able switch my code on or off separately from assertions.
I think he means that the defintition of the assert macro,
depends on the value of NDEBUG at that point in code. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Pete Wilson |
last post by:
Hi folks --
The page at
http://www.pwilson.net/submit-demo.html
will not validate. The validator at http://validator.w3.org tells me I
can't have an input inside a form.
Would some kind...
|
by: apple |
last post by:
UDBV8 fp 6a - AIX 5.1
We have scheduled cron jobs to do backups. Periodically and starting to
occur more frequently, a backup fails with this error:
SQL2072N Unable to bind the shared library...
|
by: Wito |
last post by:
hi,
I want to backup database (db2, aix 5.1) using script. When I exec script
logging to user db2inst1 then is everything ok, but from cron, I get these
error:
SQL10007N Message "-1390" could...
|
by: swartzbill2000 |
last post by:
Hello,
I have some downloaded source code on my machine that the .net
framework thinks is "not fully trusted". How can I fix this? I assume I
use the 'Microsoft .NET Framework 1.1 Configuration'...
|
by: nan |
last post by:
Hi All,
I am trying to connect the Database which is installed in AS400
using DB2 Client Version 8 in Windows box.
First i created the Catalog,
then when i selected the connection type...
|
by: Angrez Singh |
last post by:
Hi,
I am trying to use a "customcontrol" inside a "webusercontrol" but
facing problem with the viewstate of the "customcontrol".
When I use the "customcontrol" on a page either adding it...
|
by: vbfoobar |
last post by:
Hello,
I have HTML input to which I apply some changes.
Feature 1:
=======
I want to tranform all the text, but if the text is inside
an "a href" tag, I want to leave the text as it is.
...
|
by: rashedirshad |
last post by:
Is it possible to make a class inside if statement?
if true then
class a
end class
end if
|
by: Coreyja |
last post by:
I am new to Java and would greatly appreciate any help. Here is some code I am working on as basically a proof of concept. I am using a "throws FileNot FoundException". The problem is that when i run...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
|
by: GKJR |
last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
| |