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 7696253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:44:12+00:00 2026-05-31T21:44:12+00:00

I am working on a C project (still pretty new to C), and I

  • 0

I am working on a C project (still pretty new to C), and I am trying to remove all of the warnings when it’s compiled.

The original coders of this project have made a type called dyn_char (dynamic char arr) and it’s an unsigned char * type. Here’s a copy of one of the warnings:

warning: argument #1 is incompatible with prototype: prototype:
pointer to char : “…/stdio_iso.h”, line 210 argument : pointer to
unsigned char

They also use lots of standard string functions like strlen(); so the way that I have been removing these warnings is like this:

strlen((char *)myDynChar);

I can do this but some of the files have hundreds of these warnings. I could do a Find and Replace to search for strlen( and replace with strlen((char*), but is there a better way?

Is it possible to use a Macro to do something similar? Maybe something like this:

#define strlen(s) strlen((char *)s)

Firstly, would this work? Secondly, if so, is it a bad idea to do this?

Thanks!

  • 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-31T21:44:13+00:00Added an answer on May 31, 2026 at 9:44 pm

    This is an annoying problem, but here’s my two cents on it.

    First, if you can confidently change the type of dyn_char to just be char *, I would do that. Perhaps if you have a robust test program or something you can try it out and see if it still works?

    If not, you have two choices as far as I can see: fix what’s going into strlen(), or have your compiler ignore those warnings (or ignore them yourself)! I’m not one for ignoring warnings unless I have to, but as far as fixing what goes into strlen…

    If your underlying type is unsigned char *, then casting what goes into strlen() is basically telling the compiler to assume that the argument, for the purposes of being passed to strlen(), is a char *. If strlen() is the only place this is causing an issue and you can’t safely change the type, then I’d consider a search-and-replace to add in casts to be the preferable option. You could redefine strlen with a #define like you suggested (I just tried it out and it worked for me), but I would strongly recommend not doing this. If anything, I’d search-replace strlen() with USTRLEN() or something (a fake function name), and then use that as your casting macro. Overriding C library functions with your own names transparently is a maintainability nightmare!

    Two points on that: first, you’re using a different name. Second, you’re using all-caps, as is the convention for defining such a macro.

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

Sidebar

Related Questions

I have a working project that Im amending, it crashes after trying to use
I have a project working fine under MSVS 2010 SP1. I'm trying to convert
I'll try to be concise this time around! I'm still working Project Euler, this
I've been trying to get an existing project working on local copy but have
I have been trying to figure this little section of my larger project out
I'm still new with C#, and I'm working on a project where we also
I'm still working in my ACL project, and I'd like some ideas for the
I'm still working on my little Tkinter project which is simple a logging console
I working on project and have problem with threading and update of UI. I
I have a working C2DM project, atm. I have me and my colleagues phones

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.