473,770 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AMD opteron 64

Hello,

I have a test program that is compiled fine on a 32 bits redhat linux using gcc :
*************** ********
main (argc, argv)
int argc;
char *argv[];
{
int *ka;
int nka;

/* allocation dynamique entiere */
ka = (int *) malloc(nka * sizeof(int));
if (!ka) {
printf ("<ERROR> : Out of heap space (malloc) !\n");
printf ("<ERROR> : %d int words required\n", nka);
exit (-1);
}
}
*************** ********

But under linux suse AMD opteron 64, i get this message from the compiler :

warning: cast to pointer from integer of different size

Any explanation ?

Regards,
Lionel.
--
-=O=------------------------------------------=O=-
Lionel Valéro
Analyste Informatique Département Génie Chimique
École Polytechnique de Montréal
C.P. 6079, succ. centre-ville
Montréal (Québec) H3C 3A7
Tel: (514) 340 - 4711 # 4805 / C552
Fax: (514) 340 - 4159
-=O=------------------------------------------=O=-

Nov 13 '05
54 3590
Eric Sosman wrote:
there never seems to be a shortage of people willing to point out
misteaks


I want mine rare, thanks! :-)

Nov 13 '05 #51
"E. Robert Tisdale" <E.************ **@jpl.nasa.gov > writes:
[...]
If I find a great open source function library implemented in C,
a I obliged to re-implement in C++ so that "C++ folks"
will "deem it good code"? I don't think so.
I just compile it with my C++ compiler
and link it into my C++ programs.


Why not compile it with your C compiler and use extern "C"?

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://www.sdsc.edu/~kst>
Schroedinger does Shakespeare: "To be *and* not to be"
(Note new e-mail address)
Nov 13 '05 #52
On Thu, 4 Dec 2003 09:14:11 UTC, NFish <no****@nowhere .net> wrote:
The Real OS/2 Guy wrote:
On Mon, 1 Dec 2003 19:00:18 UTC, Lionel Valero
<li***********@ polymtl.ca> wrote:

I forgto the headers :
#include <stdio.h>
#include <sys/types.h>
#include <time.h>


You forgot to include stdlib.h again
Lionel Valero wrote:


ka = (int *) malloc(nka * sizeof(int));

And this cast hides the error that you forgot to include the header in
redhat linux.
Casting the result from a function that returns void* is always an
error.


Well, I wouldn't go that far. Consider replacing the first occurrence
of 'a' with 'A" in a block of 100 bytes, given that it exists.

*(char*)memchr( buffer, 'a', sizeof buffer) = 'A';

seems like a reasonable solution.

You'll get 2 problems here:
1. you forgot to include string.h. results in a faulty conversion of
int to char*
as you supperess the diagnostic the compiler will give you.
2. memchr() may return NULL - results in dereferencing a NULL pointer.

Again: never cast the result of a function that returns pointer to
void because the only you get is a faulty program.

--
Tschau/Bye
Herbert

To buy eComStation 1.1 in germany visit http://www.pc-rosenau.de

Nov 13 '05 #53
Keith Thompson wrote:
E. Robert Tisdale writes:
[...]
If I find a great open source function library implemented in C,
a I obliged to re-implement in C++ so that "C++ folks"
will "deem it good code"? I don't think so.
I just compile it with my C++ compiler
and link it into my C++ programs.


Why not compile it with your C compiler and use extern "C"?


extern "C" only *helps* with linkage.
There is no guarantee, for example, that both the C and C++ compiler
will use the same representation for int.
There is no guarantee that both compilers will pass (or return)
arguments in the same registers or on the stack in the same order.
The only reliable way to link C library functions into C++ programs
is to compile them both with the same C++ compiler.

Nov 13 '05 #54
In article <3F************ @jpl.nasa.gov>, E.************* *@jpl.nasa.gov
says...
extern "C" only *helps* with linkage.
There is no guarantee, for example, that both the C and C++ compiler
will use the same representation for int.


Which platform(s) have C and C++ compilers where this does not work.
Please give a specific example, with example code to show the failure.

--
Randy Howard _o
2reply remove FOOBAR \<,
_______________ _______()/ ()_____________ _______________ _______________ ___
SCO Spam-magnet: po********@sco. com
Nov 13 '05 #55

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1430
by: jacob nikom | last post by:
Hi, We ran MySQL (4.0.15-standard, 64-bit, SuSe 8.0) benchmarks on 2 CPU and 4 CPU Opteron machines. Mostly we tested insertion times with many simultaneous connections (hundreds). To our surprise we did not find significant differences. Each of our servers (2 and 4 CPU machine) has one 1Gbit network connection. I have feelings that the machines are the network bounded, not the CPU bounded. Could it be true? How to verify it?
0
519
by: Plymouth Acclaim | last post by:
Hi guys, We have a problem with Dual AMD64 Opteron/MySQL 4.0.18/Mandrake 10 for a very high volume site. We are evaluating the performance on our new server AMD64 and it seems it's slow compared to Dual Xeon/MySQL 4.0.15/RedHat8 and Dual Xeon/MySQL 4.0.18/Mandrake 10. And it seems there are zombie threads. 570 threads in 1 hour and we didn't even use JDBC connection pooling at all. These threads are supposed to be gone within 60...
1
1446
by: Rajrup Banerjee | last post by:
Hi, Does anybody know what are the changes to be done to compile C++ code which uses stl from SGI STL library, using g++ 3.2.3, on Linux running on AMD Opteron 64 bit? Regards, Rajrup.
1
1876
by: louis_pastorik | last post by:
Does anyone have any information about 64 bit python support for Xeon and Opteron architectures on Windows platforms? If anyone has built the python runtime on either of these platforms before I would be really interested. Thanks.
1
2333
by: Ericson Smith | last post by:
Hi, We're thinking of moving to a 64 bit platform for our database. Does anyone have any stories of migration from 32 bit to 64 bits? * How did it impact performance? * Were there any gochas? * What processors were used (any AMD Opteron's so far?) Also what kind of performance increase could we expect if we moved from a dual 32 bit to a quad 32 bit platform. (We are already using speedy
0
1222
by: J.Haan | last post by:
Hi all, at the company where I work, we're planning on installing DB2 on an AMD Opteron with 32GB of memory. Let's say we're running DB2 8.1 FP 7 in 64bit mode on SuSE Linux Enterprise Server 9.0. Can we create bufferpools with a size over 4GB? Let's say 12GB? Has anyone got any experience running such a configuration?
3
2264
by: ashokrathi | last post by:
I am trying to compile SQL procedures on Linux running on AMD/Opteron 64-bit machine. I have 'gcc', 'cc' and 'g++' compilers on my machine. I have set DB2_SQLROUTINE_COMPILE_COMMAND with various options, such as, db2set DB2_SQLROUTINE_COMPILE_COMMAND="gcc -fPIC -$HOME/sqllib/include SQLROUTINE_FILENAME.c -shared -o SQLROUTINE_FILENAME -L$HOME/sqllib/lib -ldb2" I have tried with/without "-fPIC" option. Without "-fPIC", I get following...
1
1545
by: Rocael Hernandez | last post by:
Hello all, I was wondering what's best for PG, since we have to decide what will be the new server for our DB, that will serve one or more websites. Our actual configuration is a dual xeon 2.8ghz with 4Gb ram + scsi disks, and works fine, though some intensive insert/update processes has taken it to 100% cpu use.
4
2340
by: LLessieux | last post by:
Hi, I have been seeing a strange behaviour when doing some tests on a Dual - Dual Core Opteron system using Windows XP (32bits with SP2). In out application we have a wrapper around the thread pool to handle the work on renderers and CPU intensive tasks. On the Dual - Dual Core Opteron, the application is correctly starting 4 threads but it seems to be running only 2 concurrently.
0
9618
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10260
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9906
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8933
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7456
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.