I am looking for some open source tools that have specific 32 to 64 bit
code. The reason is that I am writing paper on porting 32 bit
applications to 64 bit. When Digital introduced the 64 bit Alpha chip in
the early 1990s, it modified lint by adding a specific mode to flag many
32 to 64 bit issues (I was the lint maintainer for the Alpha when
OSF1/Digital Uniux/Tru64 Unix was released). For instance, the following
code fragment:
long n;
int i = -2;
unsigned k = 1;
n = i + k;
On a 32 bit system, n == -1, but on a 64 bit system n == 4294967295.
This is because the expression (i + k) is an unsigned int expression,
and when assigned to n, the sign will not extend.
I'm looking for a tool or set of tools that might be able to find
anomalies like this to help programmers port their applications to 64
bits. Note that GCC will flag some issue, but not specific 32 to 64 bit
issues that are legal C or C++).
--
Jerry Feldman <gaf(a)blu.org>
Boston Linux and Unix user group
http://www.blu.org PGP key id:C5061EA9
PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
When I run the following program (did not write it) on a 32 bit machine it
will not compile and run correctly. However if I compile and run it on my 64
bit machine it works fine.
Would appreciate any ideas on this, do you think this is a bug or is there a
problem with the compiler or the program?
Thanks for any help you can give!!
Charley
Program
#include <fstream>
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
unsigned long long kb = 1024;
unsigned long long mb = kb * kb;
unsigned long long gb = kb * mb;
unsigned long long four_gb = gb * 4;
long long ten_gb = gb * 10;
int write_count = four_gb / kb;
cout << "kb: " << kb
<< "\nmb: " << mb
<< "\ngb: " << gb
<< "\nfour_gb: " << four_gb
<< "\nten_gb: " << ten_gb
<< endl;
unsigned char* buf = new unsigned char[kb];
memset(buf, 0, kb);
double total_writes = write_count;
double writes = 0;
ofstream os("big_file");
cout << setiosflags(ios::fixed)
<< setprecision(0);
for (int i = 0; i < write_count; ++i)
{
os.write((char*)buf, kb);
++writes;
cout << "\r" << setw(3)
<< (writes / total_writes * 100.0) << "%"
<< flush;
}
os.close();
cout << "\r100%\nFinished..." << endl;
// Open for reading and test seek.
ifstream is("big_file");
std::streampos pos = four_gb-1000; // Arbitary position.
is.seekg(pos);
std::streampos new_pos = is.tellg();
if (pos == new_pos)
{
cout << "Seek to " << pos << " worked!" << endl;
}
else
{
cout << "Seek to " << pos << " failed!" << endl;
}
is.close();
return 0;
}
Maybe every one knows about this business ... just in case ...
I was about to buy a very expensive laptop from this company last year
... then a friend of mine found some inconsistencies in
the internal architecture description taht I requested from them .. ....
http://www.sniggle.net/qlilinux.html
Dear Paul.
I am still confused.
Sorry I am a really beginner in GNU C++.
1. May I make 2 classes in one file?
2. header is somewhat like this : "#include
<iostream.h>.
I am confused how should the header file of my "menu"
class for registering "samba" class in the "menu"
class?
Could you give me an example of the header file of my
"menu" class please....?
Thank you very much in advance.
--- Paul Howie <paulhowie(a)gmail.com> wrote:
> You need to pre-declare the class samba.
>
> Just moving it above the main method should do the
> trick, but you
> might want to declare it in a header file for
> safety.
>
> Paul
>
>
> On Thu, 30 Sep 2004 05:16:01 -0700 (PDT), Prabu
> Subroto
> <prabu_subroto(a)yahoo.com> wrote:
> > Dear my friends..
> >
> > I am practicing GNU C++ on SuSE 9.1.
> >
> > But if I compile my code I got this error message
> as
> > below:
> > ====
> > patrixlinux@patrix:~/arsip/proyek/gcc/liss> g++ -o
> > liss ./liss.cpp
> > In file included from
> > /usr/include/g++/backward/iostream.h:31,
> > from liss.cpp:1:
> > /usr/include/g++/backward/backward_warning.h:32:2:
> > warning: #warning This file includes at least one
> > deprecated or antiquated header. Please consider
> using
> > one of the 32 headers found in section 17.4.1.2 of
> the
> > C++ standard. Examples include substituting the
> <X>
> > header for the <X.h> header for C++ includes, or
> > <sstream> instead of the deprecated header
> > <strstream.h>. To disable this warning use
> > -Wno-deprecated.
> > liss.cpp: In member function `void
> menu::tampil()':
> > liss.cpp:19: error: `samba' undeclared (first use
> this
> > function)
> > liss.cpp:19: error: (Each undeclared identifier is
> > reported only once for each
> > function it appears in.)
> > liss.cpp:19: error: `s' undeclared (first use this
> > function)
> > liss.cpp:19: error: syntax error before `(' token
> > liss.cpp: At global scope:
> > liss.cpp:39: error: `struct samba' used prior to
> > declaration
> > patrixlinux@patrix:~/arsip/proyek/gcc/liss>
> > ====
> >
> > Why is it so?
> >
> > Thank you very much in advance.
> >
> > ps.Sorry for my stupid question.
> > ====
> > Here is my code.
> > ====
> > #include <iostream.h>
> > #include <ctype.h>
> > #include <stdlib.h>
> >
> > class menu {
> > public:
> > char pilihan;
> > void tampil();
> >
> > };
> >
> > void menu::tampil(){
> > for (;;){
> > cout << "Menu : (S)amba (P)ostfix (B)ind
> (Q)uit\n";
> > cin >> pilihan;
> > switch ( toupper(pilihan) ){
> > case 'S':
> > cout << "You are administrating Samba Server" <<
> endl;
> > samba * s = new samba();
> > s->tampil();
> >
> > break;
> > case 'P':
> > cout << "You are administrating Postfix Server" <<
> > endl;
> > break;
> > case 'B':
> > cout << "You are administrating BIND Server" <<
> endl;
> > break;
> > case 'Q':
> > cout << "You selected Quit. Good bye!" << endl;
> > exit(0);
> > default:
> > cout << "***No such command!***" << endl;
> > break;
> > }
> > }
> > }
> >
> > class samba {
> > public:
> > char resource[50];
> > void tampil();
> > };
> >
> > void samba::tampil(){
> > for(;;){
> > cout << "Share file or directory: ";
> > cin >> resource;
> > }
> > }
> >
> > int main(){
> > menu * m = new menu();
> > m->tampil();
> > return 0;
> > }
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Mail - 50x more storage than other
> providers!
> > http://promotions.yahoo.com/new_mail
> >
> > --
> > To unsubscribe, email:
> suse-programming-e-unsubscribe(a)suse.com
> > For additional commands, email:
> suse-programming-e-help(a)suse.com
> > Archives can be found at:
> http://lists.suse.com/archive/suse-programming-e
> >
> >
>
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com
Dear my friends...
I am writing a program with Qt and SuSE 9.1.
I want my application read the content of file
"otentik.txt".
I do like this :
QString lines;
QFile file( "otentik.txt" );
if ( file.open( IO_ReadOnly ) ) {
QTextStream stream( &file );
QString line;
int i = 1;
lines = stream.readLine();
QString cetak = QString("file otentik %1 : %1")
.arg(QString::number(i))
.arg(lines);
printf(cetak);
file.close();
QString pesan = QString("sampe sini 1. init. lines
=%1")
.arg(lines);
statusBar()->message(pesan, 300000);
}
but the content of "lines" is always empty.
The status of my QMainWindow(MDI Form) shows only :
"sampe sini 1. init.lines=".
I put this code into init() (constructor) of my
QMainWindow.
No error in compilation process.
Please tell me why.
Thank you very much.
__________________________________
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.
http://mobile.yahoo.com/maildemo
You are very nice.
Thank you......thank you very much.
--- Daryl Lee <dlee(a)altaregos.com> wrote:
> Congratulations! There will always be new "bumps"
> in the road. I think
> you'll find your efforts well rewarded. Let me know
> if I can help some
> more.
>
> > Dear my friend, Daryl....
> >
> > Yessss....!!! Your example code is very usefull...
> I
> > understand now.
> > After I tried to understand your code, I modified
> my
> > code (but firstly without making the class in the
> > separated header files) and it run properly.
> >
> > Than I tried to improve my code with separated
> header
> > files... and it runs propely...
> >
> > Thanks Daryl... Thank you for your patience
> helping me
> > on my first step.
> >
> > ps. Now I am doing a lot of homework at home for
> doing
> > practices from a GNU C++ book. Next time I am
> going to
> > come here with a more qualified question.
>
> --
> Daryl Lee
> Open the present--it's a gift.
>
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail
Dear my friend, Daryl....
Yessss....!!! Your example code is very usefull... I
understand now.
After I tried to understand your code, I modified my
code (but firstly without making the class in the
separated header files) and it run properly.
Than I tried to improve my code with separated header
files... and it runs propely...
Thanks Daryl... Thank you for your patience helping me
on my first step.
ps. Now I am doing a lot of homework at home for doing
practices from a GNU C++ book. Next time I am going to
come here with a more qualified question.
--- Daryl Lee <dlee(a)altaregos.com> wrote:
> See my comments inline below
>
> On Thu, Sep 30, 2004 at 06:16:10AM -0700, Prabu
> Subroto wrote:
> > Dear Paul.
> >
> > I am still confused.
> > Sorry I am a really beginner in GNU C++.
> > 1. May I make 2 classes in one file?
> You may declare (and define) as many classes as you
> like. If you have
> Java experience, this may seem strange, but this
> isn't Java.
>
> > 2. header is somewhat like this : "#include
> > <iostream.h>.
> > I am confused how should the header file of my
> "menu"
> > class for registering "samba" class in the "menu"
> > class?
> >
> > Could you give me an example of the header file of
> my
> > "menu" class please....?
>
> I took the liberty of reorganizing and reformatting
> your code. It is at
> the bottom of this message. I also took the liberty
> of repairing a
> defect you haven't encountered yet. Note the
> removal (by commenting it
> out) of the FOR loop in samba::tamil(). Finally, I
> removed the .h from
> #include <iostream.h> and added a "using namespace
> std". Your code now
> compiles silently.
>
> >
> > Thank you very much in advance.
> > --- Paul Howie <paulhowie(a)gmail.com> wrote:
> >
> > > You need to pre-declare the class samba.
> > >
> > > Just moving it above the main method should do
> the
> > > trick, but you
> > > might want to declare it in a header file for
> > > safety.
> > >
> > > Paul
> > >
> > >
> > > On Thu, 30 Sep 2004 05:16:01 -0700 (PDT), Prabu
> > > Subroto
> > > <prabu_subroto(a)yahoo.com> wrote:
> > > > Dear my friends..
> > > >
> > > > I am practicing GNU C++ on SuSE 9.1.
> > > >
> > > > But if I compile my code I got this error
> message
> > > as
> > > > below:
> > > > ====
> > > > patrixlinux@patrix:~/arsip/proyek/gcc/liss>
> g++ -o
> > > > liss ./liss.cpp
> > > > In file included from
> > > > /usr/include/g++/backward/iostream.h:31,
> > > > from liss.cpp:1:
> > > >
> /usr/include/g++/backward/backward_warning.h:32:2:
> > > > warning: #warning This file includes at least
> one
> > > > deprecated or antiquated header. Please
> consider
> > > using
> > > > one of the 32 headers found in section
> 17.4.1.2 of
> > > the
> > > > C++ standard. Examples include substituting
> the
> > > <X>
> > > > header for the <X.h> header for C++ includes,
> or
> > > > <sstream> instead of the deprecated header
> > > > <strstream.h>. To disable this warning use
> > > > -Wno-deprecated.
> > > > liss.cpp: In member function `void
> > > menu::tampil()':
> > > > liss.cpp:19: error: `samba' undeclared (first
> use
> > > this
> > > > function)
> > > > liss.cpp:19: error: (Each undeclared
> identifier is
> > > > reported only once for each
> > > > function it appears in.)
> > > > liss.cpp:19: error: `s' undeclared (first use
> this
> > > > function)
> > > > liss.cpp:19: error: syntax error before `('
> token
> > > > liss.cpp: At global scope:
> > > > liss.cpp:39: error: `struct samba' used prior
> to
> > > > declaration
> > > > patrixlinux@patrix:~/arsip/proyek/gcc/liss>
> > > > ====
> > > >
> > > > Why is it so?
> > > >
> > > > Thank you very much in advance.
> > > >
> > > > ps.Sorry for my stupid question.
> > > > ====
> > > > Here is my code.
> > > > ====
> > > > #include <iostream.h>
> > > > #include <ctype.h>
> > > > #include <stdlib.h>
> > > >
> > > > class menu {
> > > > public:
> > > > char pilihan;
> > > > void tampil();
> > > >
> > > > };
> > > >
> > > > void menu::tampil(){
> > > > for (;;){
> > > > cout << "Menu : (S)amba (P)ostfix (B)ind
> > > (Q)uit\n";
> > > > cin >> pilihan;
> > > > switch ( toupper(pilihan) ){
> > > > case 'S':
> > > > cout << "You are administrating Samba Server"
> <<
> > > endl;
> > > > samba * s = new samba();
> > > > s->tampil();
> > > >
> > > > break;
> > > > case 'P':
> > > > cout << "You are administrating Postfix
> Server" <<
> > > > endl;
> > > > break;
> > > > case 'B':
> > > > cout << "You are administrating BIND Server"
> <<
> > > endl;
> > > > break;
> > > > case 'Q':
> > > > cout << "You selected Quit. Good bye!" <<
> endl;
> > > > exit(0);
> > > > default:
> > > > cout << "***No such command!***" << endl;
> > > > break;
> > > > }
> > > > }
> > > > }
> > > >
> > > > class samba {
> > > > public:
> > > > char resource[50];
> > > > void tampil();
> > > > };
> > > >
> > > > void samba::tampil(){
> > > > for(;;){
> > > > cout << "Share file or directory: ";
> > > > cin >> resource;
> > > > }
> > > > }
> > > >
> > > > int main(){
> > > > menu * m = new menu();
> > > > m->tampil();
> > > > return 0;
> > > > }
>
> New, improved version:
>
> #include <iostream>
> #include <ctype.h>
> #include <stdlib.h>
> using namespace std;
>
> class menu {
> public:
> char pilihan;
> void tampil();
>
> };
>
> class samba {
> public:
> char resource[50];
> void tampil();
>
=== message truncated ===
__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail
Dear my friends...
I am trying to learn and practice GNU C++.
I start with this very simple program:
=====
#include <iostream.h>
#include <ctype.h>
#include <stdlib.h>
class menu {
public:
int pilihan;
void tampil();
};
int main(){
menu * m = new menu();
m->tampil();
return 0;
}
void menu::tampil(){
for (;;){
cout << "Menu : (S)amba (P)ostfix (B)ind (Q)uit\n";
cin >> pilihan;
switch ( toupper(pilihan) ){
case 'S':
cout << "You are administrating Samba Server" << endl;
break;
case 'P':
cout << "You are administrating Postfix Server" <<
endl;
break;
case 'B':
cout << "You are administrating BIND Server" << endl;
break;
cout << "You selected Quit. Good bye!" << endl;
case 'Q':
exit(0);
default:
cout << "***No such command!***" << endl;
break;
}
}
}
=====
I compiled it successfully, as below :
=====
patrixlinux@patrix:~/arsip/proyek/gcc/1> ls
liss liss.cpp liss.cpp~
patrixlinux@patrix:~/arsip/proyek/gcc/1> g++ -o liss
liss.cpp
In file included from
/usr/include/g++/backward/iostream.h:31,
from liss.cpp:1:
/usr/include/g++/backward/backward_warning.h:32:2:
warning: #warning This file includes at least one
deprecated or antiquated header. Please consider using
one of the 32 headers found in section 17.4.1.2 of the
C++ standard. Examples include substituting the <X>
header for the <X.h> header for C++ includes, or
<sstream> instead of the deprecated header
<strstream.h>. To disable this warning use
-Wno-deprecated.
patrixlinux@patrix:~/arsip/proyek/gcc/1> ./liss
Menu : (S)amba (P)ostfix (B)ind (Q)uit
s
====
But the problem is my program does not run as
expected. It does like this below without ending:
====
Menu : (S)amba (P)ostfix (B)ind (Q)uit
***No such command!***
Menu : (S)amba (P)ostfix (B)ind (Q)uit
***No such command!***
Menu : (S)amba (P)ostfix (B)ind (Q)uit
***No such command!***
Menu : (S)amba (P)ostfix (B)ind (Q)uit
***No such command!***
Menu : (S)amba (P)ostfix (B)ind (Q)uit
***No such command!***
Menu : (S)amba (P)ostfix (B)ind (Q)uit
***No such command!***
====
I aborted with <control>-<C>.
what's wrong with my code? Lookslike my code does not
receive the pressed key properly.
Please help.
Thank you very much in advance.
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail
When I compile kernel 2.6.8.1 from
ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.8.1.tar.bz2
'splash' doesn't work on boot, it won't mount CDs right (saying that it
doesn't understand 'subfs'), and X won't start (even when I recompile
the NVIDIA driver (I use the one from nvidia.com, not from Y.O.U.)). Why
not?