This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
Re: BUG in function parameter passing ??????
- To: Mark dot Koennecke at psi dot ch
- Subject: Re: BUG in function parameter passing ??????
- From: Sam Holden <sholden at pgrad dot cs dot usyd dot edu dot au>
- Date: Fri, 28 Aug 1998 13:36:40 +1000
- cc: GNU-WIN32 at cygnus dot com
- References: <98082711213612@psicla.psi.ch>
- Reply-To: sholden at cs dot usyd dot edu dot au
Mark.Koennecke@psi.ch writes:
>
>#include <stdio.h>
>#include <stdlib.h>
>#include <assert.h>
>#include <ctype.h>
>/*---------------------------------------------------------------------------*
>/
> void strtolower(char *pText)
> {
> int i;
> char *pPtr;
>
> assert(pText);
>
> for(i = 0, pPtr = pText; i < strlen(pText); i++, pPtr++)
> {
> *pPtr = tolower(*pPtr);
> }
> }
>/*---------------------------------------------------------------------*/
>
>int main(int argc, char *argv[])
>{
> char pBuffer[132];
>
> /* why does this work? */
> strcpy(pBuffer,"Hello You");
> strtolower(pBuffer);
>
> /* but this gives a segmentation violation under Cygwin*/
> strtolower("Hello You");
>
> printf("Success\n");
>
>}
Which is expected since "Hello You" is a constant string and thus ends up in
memory which is read only...
Sam
---
There's no such thing as a simple cache bug.
--Rob Pike
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".