lkml.org 
[lkml]   [2002]   [Oct]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: unhappy with current.h
On Mon, 14 Oct 2002, Daniele Lugli wrote:

>
> Try the following instead:
>
> // file shade1.cpp
>
> // excerpt from common.h
>
> #define current get_current()
>
> // my stuff
>
> struct {
> int any;
> int current[1000];
> } mine;
>
>
> // file shade2.cpp
>
> #include <stdio.h>
>
> // my stuff
>
> extern struct {
> int any;
> int current[1000];
> } mine;
>
> int main () {
> mine.current[999] = 1;
> printf ("%d\n", mine.current[999]);
> }
>
> g++ shade1.cpp shade2.cpp
>
> ./a.out => segmentation fault
>
> Regards, Daniele
>

It should have written a diagnostic which it does in C, not C++.

xxx.c:6: `get_current' declared as function returning an array
xxx.c:6: field `get_current' declared as a function

This () make all the difference. If you are trying to write kernel
drivers in C++, you will have more suprises. If not, you should
not be including kernel headers.


Cheers,
Dick Johnson
Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips).
The US military has given us many words, FUBAR, SNAFU, now ENRON.
Yes, top management were graduates of West Point and Annapolis.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:30    [W:1.048 / U:0.420 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site