473,406 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Thank you. Now i get new error.

HI

I get new error while running "make all". The error and the program is given below

Program:

Expand|Select|Wrap|Line Numbers
  1. #if defined(LIBC_SCCS) && !defined(lint)
  2. static char sccsid[] = "@(#)bcopy.c    5.7 (Berkeley) 5/16/90";
  3. #endif /* LIBC_SCCS and not lint */
  4.  
  5. #include <string.h>
  6. #include <sys/types.h>
  7.  
  8. /*
  9.  * sizeof(word) MUST BE A POWER OF TWO
  10.  * SO THAT wmask BELOW IS ALL ONES
  11.  */
  12. typedef    int word;        /* "word" used for optimal copy speed */
  13.  
  14. #define    wsize    sizeof(word)
  15. #define    wmask    (wsize - 1)
  16.  
  17. /*
  18.  * Copy a block of memory, handling overlap.
  19.  * This is the routine that actually implements
  20.  * (the portable versions of) bcopy, memcpy, and memmove.
  21.  */
  22. void bcopy(src0, dst0, length)
  23.     char *dst0;
  24.     char *src0;
  25.     register size_t length;    
  26. {
  27.     register char *dst = dst0;
  28.     register char *src = src0;
  29.     register size_t t;
  30.  
  31.     if (length == 0 || dst == src)        /* nothing to do */
  32.         return;
  33.  
  34.     /*
  35.      * Macros: loop-t-times; and loop-t-times, t>0
  36.      */
  37. #define    TLOOP(s) if (t) TLOOP1(s)
  38. #define    TLOOP1(s) do { s; } while (--t)
  39.  
  40.     if ((unsigned long)dst < (unsigned long)src) {
  41.         /*
  42.          * Copy forward.
  43.          */
  44.         t = (int)src;    /* only need low bits */
  45.         if ((t | (int)dst) & wmask) {
  46.             /*
  47.              * Try to align operands.  This cannot be done
  48.              * unless the low bits match.
  49.              */
  50.             if ((t ^ (int)dst) & wmask || length < wsize)
  51.                 t = length;
  52.             else
  53.                 t = wsize - (t & wmask);
  54.             length -= t;
  55.             TLOOP1(*dst++ = *src++);
  56.         }
  57.         /*
  58.          * Copy whole words, then mop up any trailing bytes.
  59.          */
  60.         t = length / wsize;
  61.         TLOOP(*(word *)dst = *(word *)src; src += wsize; dst += wsize);
  62.         t = length & wmask;
  63.         TLOOP(*dst++ = *src++);
  64.     } else {
  65.         /*
  66.          * Copy backwards.  Otherwise essentially the same.
  67.          * Alignment works as before, except that it takes
  68.          * (t&wmask) bytes to align, not wsize-(t&wmask).
  69.          */
  70.         src += length;
  71.         dst += length;
  72.         t = (int)src;
  73.         if ((t | (int)dst) & wmask) {
  74.             if ((t ^ (int)dst) & wmask || length <= wsize)
  75.                 t = length;
  76.             else
  77.                 t &= wmask;
  78.             length -= t;
  79.             TLOOP1(*--dst = *--src);
  80.         }
  81.         t = length / wsize;
  82.         TLOOP(src -= wsize; dst -= wsize; *(word *)dst = *(word *)src);
  83.         t = length & wmask;
  84.         TLOOP(*--dst = *--src);
  85.     }
  86.     return;
  87. }
  88.  
and i get the error:

cc -O -DUNIX -DBSD -g -I/home/English/src/java/morph-1.5/hash -I/usr/include/X11/Xaw -c -w -o lib/bcopy.o /home/English/src/java/morph-1.5/hash/bcopy.c
/home/English/src/java/morph-1.5/hash/bcopy.c: In function ‘bcopy’:
/home/English/src/java/morph-1.5/hash/bcopy.c:48: error: argument ‘src0’ doesn’t match prototype
/usr/include/bits/string3.h:90: error: prototype declaration
/home/English/src/java/morph-1.5/hash/bcopy.c:48: error: argument ‘dst0’ doesn’t match prototype
/usr/include/bits/string3.h:90: error: prototype declaration
make: *** [lib/bcopy.o] Error 1

from Line no. 44 to 51:

The program code contains

44. void bcopy(src0, dst0, length)
45. char *dst0;
46. char *src0;
47. register size_t length;
48. {
49. register char *dst = dst0;
50. register char *src = src0;
51. register size_t t;
Jul 20 '10 #1
4 1651
Oralloy
988 Expert 512MB
Isn't the prototype for bcopy

Expand|Select|Wrap|Line Numbers
  1. void bcopy(const void *s1, void *s2, size_t n);
If so, you need to change the definition you're providing.
Jul 20 '10 #2
Banfa
9,065 Expert Mod 8TB
The definition in the OP is of the type used in pre-standardised C and given the date on line 2 that kind of matches up.

However I agree that that might be the cause of the issue.
Jul 20 '10 #3
Oralloy
988 Expert 512MB
@Banfa
Banfa,

Thank you, I see I need to spend more time at the feet of the masters and just listen.

Oralloy
Jul 20 '10 #4
donbock
2,426 Expert 2GB
The error refers to a mismatch between a function prototype and a function definition, so there must be a prototype in one of the header files included by bcopy.c. You need to find that prototype and then resolve the mismatch be either changing the prototype to match the definition or by changing the definition to match the prototype or by replacing the prototype with an old-style function declaration.

I am alarmed at the juxtaposition of a function prototype and an old-style function definition. The old-style definition expects the default type conversions to be applied to the arguments whenever the function is called, however if a prototype is in scope then the arguments are converted to the types in the prototype. This violation of expectations could cause the function to misinterpret the argument value it receives. I'm pretty sure this is covered somewhere in the C FAQ, but I can't seem to bring up that web site right now to find it for you.
Jul 20 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: windandwaves | last post by:
Hi Folks I have just completed a project for an accommodation finder in New Zealand - much with your help - thank you again. I would appreciate any constructive or deconstructive comments. ...
2
by: WindAndWaves | last post by:
Is it possible to find out at what line an error occurred for an error log??? --- Please immediately let us know (by phone or return email) if (a) this email contains a virus (b) you are...
14
by: Al Smith | last post by:
I need help in implementing proper error handling. I am trying to upload a file based on the sample code below. The code works well except if the file selected is too big. I do know about the...
5
by: hb | last post by:
Hi, In my ASP.Net application 'MyWebApp' , the mode="StateServer" in <sessionState> of Web.config file, and the ASP.NET State Service is set to start automatically on the server. But every...
8
by: mohit | last post by:
Hi, I am creating a web application in Web Matrix on the .NET framework. I have two directories :AddUser and FormAuth in a Directory P. AddUser contains a file AddUser.aspx FormAuth contains :...
4
by: junaidnaseer | last post by:
Hi ! I am facing a problem that I have defined a function which when called in the same file generates an error as follows; " visual c error C2371 redefinition basic types see...
3
by: Don | last post by:
I have an ASP.NET 2.0 application (in VB) based on the Personal Site Starter kit that runs perfectly (no erros, no warnings, no exceptions) when run from Visual Studio 2005 Team Suite using the...
0
by: kammaldeep | last post by:
hi, i m newbie 2 PHP & to b frank ... will alwaz be ... i dont think i will go into much details with PHP as my work doesnot include workin with PHP bt i have a forum .. and i want to make a...
8
by: Paul Furman | last post by:
How do I turn off MySQL error reporting? I set error_reporting(0); but that doesn't seem to be working.
7
ak1dnar
by: ak1dnar | last post by:
Hi, I got this scripts from this URL There is Error when i submit the form. Line: 54 Error: 'document.getElementbyID(....)' is null or not an object What is this error. Complete Files
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.