Page MenuHomeFreeBSD

sys: Declare 'end' as an extern char so that &end is a char *
Needs ReviewPublic

Authored by jhb on Mon, Nov 24, 3:58 PM.

Details

Reviewers
jrtc27
andrew
manu
Summary

While here, remove an unused declaration.

Sponsored by: AFRL, DARPA

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 68825
Build 65708: arc lint + arc unit

Event Timeline

jhb requested review of this revision.Mon, Nov 24, 3:58 PM

s/extern char/&[]/ in the subject, also &end is not char * in that case, it's char (*)[], which is an incomplete type so you can't perform pointer arithmetic on it (as sizeof(char[]) is not known). end itself decays to a char * and so pointer arithmetic on *that* works (or &end[0], but decaying is cleaner). In this case though there's an explicit cast before the arithmetic so both "work".