Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Is this valid C code?

Name: Anonymous 2017-01-02 2:13

char x [5] = { 0xf0, 0x0f, 0xc7, 0xc8 };

main ()
{
void (*f)() = x;
f();
}


Found this on the Everything2 page for the Pentium F00F bug. My question is essentially whether it is indeed valid to write machine code subroutines as byte arrays and call them via a function pointer. Does the Standard have anything to say about this? And is executing code in the data segment even possible on modern architectures?

Name: Anonymous 2017-01-03 7:54

>>6,9
so you're being pedantic about corner cases that don't apply to the example discussed in this thread simply for the sake of being pedantic? you're the programming equivalent of that guy who complains how your URL is not actually a valid URL but a URI. which is the networking equivalent of that guy who complains about sound in space in science fiction movies.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List