mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* PROBLEM: Compatibility problem with C++, i386 & ia64 platform
@ 2004-11-23 12:54 Joakim Bentholm XQ (AS/EAB)
  2004-11-23 19:47 ` Sam Ravnborg
  2004-11-25 15:54 ` Alan Cox
  0 siblings, 2 replies; 3+ messages in thread
From: Joakim Bentholm XQ (AS/EAB) @ 2004-11-23 12:54 UTC (permalink / raw)
  To: 'linux-kernel@vger.kernel.org'

1. Compatibility errors when including <asm/system.h> with g++ compiler on i386 and ia64 platforms.


If you want to use the memory barrier macros mb(), rmb() and wmb(), as defined in <asm/system.h>.

On i386 platform:
This will work if you use gcc, but not in g++, since the name of the parameter in the __cmpxchg(...) is new, which the C++ compiler will not accept. (new_val might have been a better choice ;-)

Function header
---
static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
				      unsigned long new, int size)
---


On Itanium 2 platform:
Compiling on Itanium 2 works if you add som typedefs and a define, which is normally defined when __KERNEL__ is enabled. 

Prepended rows to the include of system.h
---
#define __pa(x) x
typedef long s64;
typedef int s32;
typedef unsigned long u64;
typedef unsigned int u32;
#include <asm/system.h>
---


Maybe the system.h is not supposed to be included outside the kernel?
Is there a less crude way of getting hold of the macros?

Best Regards/JB

--
Joakim Bentholm
joakim.xq.bentholm@ericsson.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PROBLEM: Compatibility problem with C++, i386 & ia64 platform
  2004-11-23 12:54 PROBLEM: Compatibility problem with C++, i386 & ia64 platform Joakim Bentholm XQ (AS/EAB)
@ 2004-11-23 19:47 ` Sam Ravnborg
  2004-11-25 15:54 ` Alan Cox
  1 sibling, 0 replies; 3+ messages in thread
From: Sam Ravnborg @ 2004-11-23 19:47 UTC (permalink / raw)
  To: Joakim Bentholm XQ (AS/EAB); +Cc: 'linux-kernel@vger.kernel.org'

[Snipped - about C++ compatibility]

The Linux kernel philosofy is not to support any type of C++.
And kernel provided header files are not supposed to be included
from userspace - use a sanitized version instead.

Developing modules in C++ is not supported.

	Sam

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PROBLEM: Compatibility problem with C++, i386 & ia64 platform
  2004-11-23 12:54 PROBLEM: Compatibility problem with C++, i386 & ia64 platform Joakim Bentholm XQ (AS/EAB)
  2004-11-23 19:47 ` Sam Ravnborg
@ 2004-11-25 15:54 ` Alan Cox
  1 sibling, 0 replies; 3+ messages in thread
From: Alan Cox @ 2004-11-25 15:54 UTC (permalink / raw)
  To: Joakim Bentholm XQ (AS/EAB); +Cc: 'linux-kernel@vger.kernel.org'

On Maw, 2004-11-23 at 12:54, Joakim Bentholm XQ (AS/EAB) wrote:
> Maybe the system.h is not supposed to be included outside the kernel?
> Is there a less crude way of getting hold of the macros?

Nobody has really done serious C++ work with the base kernel. Getting
things like interrupt safe C++ memory and exception handling is not
exactly trivial
stuff. As such the kernel isn't really designed to be C++ friendly so
there are various uses of names like "new" in the kernel.

Developing kernel modules with C++ probably isn't ideal but I don't see
any problem in fixing the users of variables like "new" if you want to
do it and submit tested patches to akpm@osdl.org.

Alan


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-11-27  1:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-23 12:54 PROBLEM: Compatibility problem with C++, i386 & ia64 platform Joakim Bentholm XQ (AS/EAB)
2004-11-23 19:47 ` Sam Ravnborg
2004-11-25 15:54 ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®