Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7649759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:03:14+00:00 2026-05-31T11:03:14+00:00

I have an algorithm written in C and it has code which can be

  • 0

I have an algorithm written in C and it has code which can be handled by C preprocessor but as there is no preprocessor in java i don’t know how to write java code to handle such thing.
The C code is

#ifdef Tile_size_utility
#define print_error 0
else
#define print_error 1
#endif

How can i implement this in Java?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T11:03:15+00:00Added an answer on May 31, 2026 at 11:03 am
     Class ErrorVerbose { 
              private static boolean enabled = False;
    
              public static setEnable(boolean enable) 
                    enabled = enable;
              }
    
              public static perror(String msg) {
    
                   if (enabled) {
                   /* Print */ 
                   }
    
              }
       }
    
    
     class YourClass {
    
               public YourClass(....,boolean status) {
    
                    ErrorVerbose.SetEnable(status)
                        .
                        . 
               }
    
       }
    

    Well, yes, either you can make is a non static class so that other classes can enable / disable verbose. Advantage of making a ErrorVerbose class is that you add more info like time, date, function name (which called), etc which makes it more informative I just gave a skeleton.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have code written in c, which contains some complex algorithms and I want
I have written an algorithm which iteratively solves the problem. The first iteration consists
I have written an algorithm for generating a Sudoku board but it is failing.
I have written 2 implementation of bubble sort algorithm in C and Haskell. Haskell
So I have some cool Image Processing algorithm. I have written it in OCaml.
I have algorithm/computation in Java and unit test for it. The unit test expects
I have this algorithm in Java to store passwords in database. I'd like to
I have written some physics simulation code in C++ and parsing the input text
I have written a MySQL query (Ad rotate algorithm) to fetch records from multiple
I have writen the following code but when i execute him i get this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.