🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Steve Peshman x7-4406 Thu, 06 Aug 1992 22:02
possible bug in the C compiler
#294
Author: Steve Peshman x7-4406
Date: Thu, 06 Aug 1992 22:02
33 lines
1404 bytes
/*
 * I believe this may be a bug in version 1.4 of the C compiler.
 * With the -pedantic switch, I am unable to increment a void pointer.
 * Here is a copy of the results I get:
 *
 * chinook-peshman% gcc -pedantic -o ped.o ped.c
 * ped.c: In function tfunc:
 * ped.c:24: invalid lvalue in increment
 * ped.c:25: invalid lvalue in assignment
 * ped.c:26: invalid lvalue in assignment
 * chinook-peshman% 
 *
 * The closest I can come to incrementing a void pointer is to assign it
 * to a pointer to the appropriate type and increment that.
 *
 * I apologies if this is simply a result of my ignorance.  In that event,
 * please let me know the correct way to do this.
 */
void tfunc(void *voidp)
{
    int *intp;

/* this stuff does not work */
    ((int *)voidp)++;
    ((int *)voidp) += 1;
    ((int *)voidp) = ((int *)voidp) + 1;

/* but this stuff does */
    intp = (int *)voidp;
    intp++;
}
/* Steve Peshman */
/* I'm told I can be reached at peshmanS@med.ge.com */
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads