LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-16-2012, 07:22 AM   #1
hamidi2
Member
 
Registered: Aug 2012
Posts: 61

Rep: Reputation: Disabled
910725 - where's _DEBUG?


in Windows, applications usually are deployed in two versions, debug and release. in case of debug, _DEBUG is defined. in Linux, it's a good idea to have such a variable, eg. for when we want to log some info in some cases. this should happen only in debug mode.
is there such a thing in Linux?
thx
 
Old 10-16-2012, 08:58 AM   #2
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by hamidi2 View Post
in Windows, applications usually are deployed in two versions, debug and release. in case of debug, _DEBUG is defined.
Bruce Schneier and Neils Ferguson say in Practical Cryptography that you should not have a separate debug and release version of your software and they provide several good reasons for this.
Quote:
Originally Posted by hamidi2 View Post
in Linux, it's a good idea to have such a variable
Once again, this is not a good idea.
Quote:
Originally Posted by hamidi2 View Post
eg. for when we want to log some info in some cases. this should happen only in debug mode. is there such a thing in Linux?
You could create "debug" and "release" targets in your Makefile and pass "-D _DEBUG" in the debug target. However, the real solution is to have only one target and enable logging using a command line switch or a variable in a configuration file. When your software is deployed in some remote location, and you get a request for support, you can ask your customer to enable debug logging. You won't regret it and your customer will thank you.
 
1 members found this post helpful.
Old 10-17-2012, 01:25 AM   #3
hamidi2
Member
 
Registered: Aug 2012
Posts: 61

Original Poster
Rep: Reputation: Disabled
thanx 4 replying
i didn't know that and i got curious to know what might have been the reasons.
then i thought about that. using a config file or a command line switch is a good idea. it even gives more flexibility to customize the behavior of programs. for example, instead of logging or not logging, user may decide to define a debug level and decide what to be logged. sounds a good idea.
thx
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off




All times are GMT -5. The time now is 05:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration