[c-prog] Re: [ANNOUNCE] rebase - A math game for the console

2009-09-18 Thread Pedro
--- johnmatthews2000 jm5...@... wrote: 9. You print out the user's average time before calling statistics_append, so the printed average doesn't include the last result. I don't know if this is deliberate, but it looks like a bug. It is a feature: It causes the user to compete

[c-prog] Re: how i can get list of files in directory .. i want to read files line by line in c languages

2009-09-21 Thread Pedro
--- In c-prog@yahoogroups.com, dinesh akhand dinesh_akhand...@... wrote: i want to need c programme .that works on linux . Use opendir, readdir and closedir. Vx works i am using.. They should work there.

[c-prog] Re: Hello guys i am new but i have being practicing to develop my skills professiona

2009-09-21 Thread Pedro
--- Solomon perkins.solo...@... wrote: well i am almost finih with Cprogramming- wanna know some tips before i advance to the next level I started to learn C many years ago and I did not finish learning it yet. Do you already know every detail of the standard ISO 9899 ?

[c-prog] x86: Branch hint prefixes (2EH, 3EH)

2009-10-01 Thread Pedro
From the Intel's manual (253666.pdf): Branch hint prefixes (2EH, 3EH) allow a program to give a hint to the processor about the most likely code path for a branch. Use these prefixes only with conditional branch instructions (Jcc). 1) Are they generated by any C compiler? 2) How to give the

[c-prog] How to lock a file on Posix systems?

2009-12-11 Thread Pedro
How to lock a file on Posix systems? I know how joe and OpenOffice lock the file being edited. But: What is the right way to lock a file across multiple processes? The method that joe and OpenOffice use to lock the file is not protected against different applications.

[c-prog] Re: How to lock a file on Posix systems?

2009-12-11 Thread Pedro
--- I wrote: How to lock a file on Posix systems? I know how joe and OpenOffice lock the file being edited. But: What is the right way to lock a file across multiple processes? The method that joe and OpenOffice use to lock the file is not protected against different applications.

[c-prog] Re: must have class/struct/union compile error ?

2010-01-30 Thread Pedro
diff widget.h~ widget.h 8c8 myColor backColor(); --- myColor backColor; --- In c-prog@yahoogroups.com, Jimmy Johnson boxer...@... wrote: I am getting the following errors and I am pulling my hair out. If someone could help I would greatly appreciate it. As I don't know where this is

[c-prog] Re: must have class/struct/union compile error ?

2010-01-31 Thread Pedro
--- In c-prog@yahoogroups.com, Jimmy Johnson boxer...@... wrote: 20 years of using a language not requiring empty argument lists is making the c++ programming hard. From which language you are coming?

[c-prog] Re: Insertin Sort problem

2010-01-31 Thread Pedro
Shamir Shakir, I rewrote your code: #include iostream using namespace std ; #define LIMIT 13 int main() { int i; int array[LIMIT] = {6, 8, 9, 10, 12, 7, 1, 3, 2, 14, 13, 5, 4} ; cout Before sorting: endl ; for (i=0; iLIMIT; i++) cout array[i] ;

[c-prog] OT: A small POS

2010-03-11 Thread Pedro
I was thinking about: Is the sh operator to redirect and append a single fwrite to stdout atomic or not? Can you prove your answer to the question above? And on cmd.exe, is the operator atomic? Then I thought about the following POS. It is a command for sh: while [[ true ]] ; do

[c-prog] Re: OT: A small POS

2010-03-11 Thread Pedro
--- Paul Herring wrote: I wrote:  I was thinking about:  Is the sh operator to redirect and append a single fwrite to stdout atomic or not? Nope. Not in the conventional programming sense of the word anyway.  Can you prove your answer to the question above? Imagine two

[c-prog] Re: OT: A small POS

2010-03-12 Thread Pedro
 If fwrite (ptr, size, 1, f) is atomic Is it? If f is _IONBF then yes. and  the sh operator use the system call dup(int) then  the sh operator is atomic. will use a lot more functions that can be pre-empted than just those two. A lot more. The simplest way to implement

[c-prog] fstream exceptions

2010-04-03 Thread Pedro
The code is after the question. What is the advantage of using fstream exceptions if the single error message I can get from it is: basic_ios::clear ? The old C approach of using strerror(errno) is much better as it is detailed and localized. // hello.cpp - Prints Hello,\n to the given

[c-prog] PRIdPTR

2010-04-27 Thread Pedro
Is the following coded right? #include inttypes.h #include stdio.h int main (int argc, char **argv) { printf (argc is stored at address %PRIdPTR decimal.\n, argc); return 0; }

[c-prog] Re: PRIdPTR

2010-04-29 Thread Pedro
What is the purpose in using PRIdPTR? The purpose of PRIdPTR is not written in the standard. I think its purpose is to print a memory address as a signed decimal, as PRIuPTR also exists. But some programmers think otherwise.

[c-prog] sign of char

2010-04-29 Thread Pedro
I know the standard says that: Irrespective of the choice made, char is a separate type from the other two and is not compatible with either. What is the advantage of char being signed over char being unsigned? Which program uses signed char?

[c-prog] struct stat st_ino

2010-04-30 Thread Pedro
Is the inode number of a file constant during the file's lifetime?

[c-prog] Re: struct stat st_ino

2010-05-03 Thread Pedro
--- I, Pedro Izecksohn, asked: Is the inode number of a file constant during the file's lifetime? Three different answers were sent to this group: --- Santosh Vernekar santosh@... wrote: -No, may not be. Try opening a file in vi text editor and modify it before closing the file

[c-prog] C++ pointer ?

2010-05-05 Thread Pedro
In the code below, what is the type of pi? #include cstdio using namespace std; int main (int argc, char **argv) { int i = 3; int pi = i; printf (i = %d\n, pi); return 0; }

[c-prog] Re: C++ pointer ?

2010-05-05 Thread Pedro
--- Brett McCoy idragos...@... wrote: I, Pedro izecks...@... wrote:  In the code below, what is the type of pi? #include cstdio using namespace std; int main (int argc, char **argv) {  int i = 3;  int pi = i;  printf (i = %d\n, pi);  return 0; } pi is a reference

[c-prog] Re: C++ pointer ?

2010-05-05 Thread Pedro
--- Brett McCoy idragos...@... answered: I, Pedro izecks...@... asked:  What are the differences between a reference and a pointer? http://www.parashift.com/c++-faq-lite/references.html#faq-8.6 Thank you very much.

[c-prog] operator=

2010-05-20 Thread Pedro
#include cassert #include iostream using namespace std; class Pointer { public: Pointer *p; Pointer () { cout I\'m inside Pointer (void); endl; p = this; } Pointer operator= (const Pointer notused) { cout I\'m inside operator= (const Pointer ); endl;

[c-prog] Re: operator=

2010-05-20 Thread Pedro
--- I, Pedro izecks...@..., asked: Pointer q = p; // Why q.operator=(p) is not being called? --- Paul Herring pauljherr...@... answered: Because the constructor is being called in this instance: Thank you very much.

[c-prog] Re: How do we time our algo/program

2010-08-04 Thread Pedro
--- Dodo Speaks dodospe...@... asked: I have seen on various coding competition sites that also take the time taken by the algorithm code in consideration for judging purpose. Just wanted to know how do we calculate this time, do we use any software for that. Please let me know the way. I

[c-prog] Re: hi

2010-08-12 Thread Pedro
--- Aims Boy aims_boy2...@... wrote: How I make a program of process of creation and deletion in C++ language of Linux operating system? I'm not sure if you asked about the C++ operators new and delete or if you asked about how to create and delete a file. About the C++ operators new

[c-prog] Re: HW Question

2010-08-12 Thread Pedro
--- Nawlins Nightmare paulnorri...@... posted code which I fixed and incremented it: /** The output from the program should be as follows: List 1: 10 20 30 40 List 2: 100 200 300 400 List 2 after concat: 100 200 300 400 10 20 30 40 List 3: 10 20 30 40 List 3 equals List 1: 1 List 1 equals

[c-prog] Re: HW Question

2010-08-12 Thread Pedro
--- Nawlins Nightmare paulnorri...@... wrote: Hello! I need help with the program below. I'm required to add the contents of second list to the end of contents of the first list in the void concat section. This is certainly not a HardWare question. HW does not mean Hello World for

[c-prog] Can a function return an array of 4 pointers?

2010-08-28 Thread Pedro
struct four_pointers { char *a[4]; }; typedef struct four_pointers four_pointers; Is it possible for a function to return an array of 4 pointers to char without encapsulating them inside a struct? I know it is impossible to have an automatic variable length array. But the array I'd like

[c-prog] fputwc and gcc

2006-08-18 Thread Pedro Izecksohn
Does the code below compile with gcc and run on your machine? Do you see all the right characters? Or most characters appear as question marks? Could you give me details (OS, libc, processor, distro)? Do not answer if you are not compiling with gcc. Mingw and Cygwin answers are welcome.

[c-prog] Re: fputwc and gcc

2006-08-19 Thread Pedro Izecksohn
As my problem is Linux specific, (or may be it is distro specific), I'll move it to some other forum. To unsubscribe, send a blank message to mailto:[EMAIL PROTECTED]. Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/c-prog/ * To

[c-prog] Execute Disable Bit

2006-12-01 Thread Pedro Izecksohn
Could you post your results? #include stdio.h #include stdlib.h _Bool xdb () { unsigned int d; __asm__(cpuid:=d(d):a(0x8001):%ebx,%ecx); return ((d0x10)==0x10); } char * code = \xC3; // ret char buffer; int main (int argc, char ** argv) { void (*function)(); char opcode;

[c-prog] Re: Disable printf

2006-12-01 Thread Pedro Izecksohn
--- kldan_ng wrote: I would need to put a #include common.h line into each c file. ... Is there any way to insert the line automatically into each c file? for c in old/*.c ; do cat insert $c new/$c ; done ; You must create new/old/

[c-prog] Re: how can i save any image in bmp or jpg format using c? plz help

2006-12-01 Thread Pedro Izecksohn
--- raj2642 wrote: don't know how to save any image on the screen to file in bitmap, or any compressed file format, please help? http://www.fortunecity.com/skyscraper/windows/364/bmpffrmt.html http://www.jpeg.org/ Yahoo! Search is your friend. I searched: bitmap file format jpeg file

[c-prog] Re: What is the difference between Global and Static variables ?

2006-12-01 Thread Pedro Izecksohn
--- Ray Devore wrote: You can have global static variables. It is wrong. The scope of a static variable defined outside any function is only inside that source file. At least I'm not the only guy who writes wrong concepts some times. ;)

Re: [c-prog] Regarding static variables

2006-12-04 Thread Pedro Izecksohn
When a static variable got initilized? At compilation time or loading time? At compilation time. If it's compliation time ,does the exe contain the inilized values? The exe contains the initialized values. Then how do we able to change that varible run time ? The linker

[c-prog] oot: RICE IN ASIA

2006-12-05 Thread Pedro Izecksohn
--- Paul Herring [EMAIL PROTECTED] wrote: andyg721: i think it was on CNN andyg721: Condoleeza Rice went to Asia andyg721: the headline was RICE IN ASIA It may yet be read at: http://www.washtimes.com/op-ed/20051019-085631-5161r.htm

[c-prog] ot: asm nx bug?

2006-12-05 Thread Pedro Izecksohn
If you have a PC that supports Execute Disable Bit: I posted some code here before http://tech.groups.yahoo.com/group/c-prog/message/59685 but I received no good answer. I detailed more the bug at http://www.izecksohn.com/pedro/xdb/ There is code I did not post here. Could you help me

Re: [c-prog] difer btwn *ptr++ (*ptr)++

2006-12-06 Thread Pedro Izecksohn
--- Uma Maheswara Rao Lankoti [EMAIL PROTECTED] wrote: for *ptr++ : unary ++ operator is having higher priority than unary * operator. so *ptr++ is equal to *(ptr++). ie, its pointing to the value next to previously pointing one. Are you sure?

Re: [c-prog] difer btwn *ptr++ (*ptr)++

2006-12-07 Thread Pedro Izecksohn
--- Sunil Nair [EMAIL PROTECTED] wrote: s...provided might be compiler dependent.. #include stdio.h int main (int argc, char ** argv) { int i=12345, *ip=i; printf (%d\n,*ip++); printf (%d\n,*ip); return 0; } Which compiler are you using? Unary operators ... associate from

Re: [c-prog] You Must View This Videoclip!

2006-12-07 Thread Pedro Izecksohn
Is praveen_asl part of this group? Is he innocent? Else he should be banned. When you want to send a virus to this list, send it as source code, for us to joy reviewing it. I could not yet download it, blocked by Yahoo Mail.

Re: [c-prog] how to open notepad

2006-12-08 Thread Pedro Izecksohn
--- vineet kumar [EMAIL PROTECTED] wrote: how can i open notepad through c pl tell me any function or instruction. thnx http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt__exec.2c_._wexec_functions.asp

Re: [c-prog] need help

2006-12-08 Thread Pedro Izecksohn
--- ed [EMAIL PROTECTED] wrote: in soviet russia homework writes you!! The guy is in Egypt. Yahoo! Music Unlimited Access over 1 million songs. http://music.yahoo.com/unlimited

Re: [c-prog] difer btwn *ptr++ (*ptr)++

2006-12-09 Thread Pedro Izecksohn
--- Sunil Nair [EMAIL PROTECTED] wrote: Can you use your brain? How do i judge compiler depedencies thru my brain... May be u could. Did you see the code I sent you? You replied the message but you did not try to compile my code. Read well your own message at:

[c-prog] Re: runing c/c++ in linux

2007-01-06 Thread Pedro Izecksohn
--- jahid32s wrote: hi i am jahide i am new i linux. I can not run c/c++ program in linux. can any one help me? Try to put ./ before your program's name, as in: [EMAIL PROTECTED]:~$ ./hello

Re: [c-prog] Win32 locale

2007-02-06 Thread Pedro Izecksohn
--- Thomas Hruska [EMAIL PROTECTED] wrote: I think you are looking for LCIDs. The answer is Yes on both a user-level and system-level basis. http://www.microsoft.com/globaldev/reference/lcid-all.mspx http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/nls_08tg.asp

[c-prog] Re: Inventory Program and getline problem

2007-03-14 Thread Pedro Izecksohn
--- In c-prog@yahoogroups.com, Eyyo.Net Web Hosting and Design [EMAIL PROTECTED] wrote: I am getting a trouble with getline function. What is that? Let me explain little. I coded an inventory program which is my first C++ program and I am using DEV C++ 4.9.2.2 something. Ok. I already

Re: [c-prog] Re: ISO/IEC 9899:1999 stdbool.h true

2007-05-27 Thread Pedro Izecksohn
Saurabh Jain asked: are you sure xy == xy??? Am I missing something? Pedro's reply: Shyan Lam, thinking that I mistyped, meant that: if ((x y) == true) may be shortened to: if (x y) But my bug was to think that: if (xy) is equivalent to: if ((xy)==true)

Re: [c-prog] Re: ISO/IEC 9899:1999 stdbool.h true

2007-05-27 Thread Pedro Izecksohn
I wrote: Peternilsson42 replied: If any value not zero is true why true which expands to the integer constant 1? How can a macro expand to multiple values? That's the problem. #define true (_Bool)1 And: int i=5; _Bool b=true; if (i==b) // should generate a warning.

Re: [c-prog] Re: ISO/IEC 9899:1999 stdbool.h true

2007-05-29 Thread Pedro Izecksohn
if (i==b) If you're suggesting this should be an error, then should the following be an error also? struct { unsigned flag1 : 1; unsigned flag2 : 1; } x; if (x.flag1 == true) If I would write the C standard, or I would make restrictions to use true or I would not declare

[c-prog] ICMP

2007-07-06 Thread Pedro Izecksohn
Do you know about any bad ICMP usage (other than ping of death)? Could you post source code of any trojan that uses ICMP to communicate? To the moderators: Please do not block this message, nor any possible answer, as I want to understand why someone in my ISP configured the firewall to

Re: [c-prog] ICMP

2007-07-07 Thread Pedro Izecksohn
I want to understand why someone in my ISP configured the firewall to block ICMP. ISPs will block incoming ICMP packets to help hide the existence of their customers. It is a user-friendly feature! Every time I send an e-mail, the receiver knows my IP. Every time I visit some webpage,

Re: [c-prog] command_line_arguments_ in _C

2007-07-08 Thread Pedro Izecksohn
asma sabir wrote: I'm doing OS course in Linux where I m not understanding the command line. is it like DOS cmd line? And I am too confused in cammand_line_arguments like argc and pointer argv. I want to know about each and every thing about these, because of this i could not understand the

Re: [c-prog] while((a = getchar()) == EOF) is the way to get around getc()?

2007-07-08 Thread Pedro Izecksohn
acuteheptagram wrote: I thought while((a = getc()) == EOF) was the way to get around getc()? I want to have the program skip over getc()when nothing is being entered on the uart. My reply: Is getc blocking your program? Search for O_NONBLOCK or O_ASYNC .

Re: [c-prog] command_line_arguments_ in _C

2007-07-09 Thread Pedro Izecksohn
asma sabir asked: Can anybody explain this code specially the main() function with its arguments? I reply: To complement what Mina Ramses already explained, by another example: #include stdio.h int main (int argc, char **argv) { while (argc) { printf (%s\n, argv[argc-1]); argc--; }

Re: [c-prog] Strange macro

2007-08-18 Thread Pedro Izecksohn
-- Ahmed Shabana asked: #if LINUX_VERSION_CODE KERNEL_VERSION(2,6,13) #define NVVER FEDORA5 #elif LINUX_VERSION_CODE KERNEL_VERSION(2,6,9) #define NVVER SUSE10 #elif LINUX_VERSION_CODE KERNEL_VERSION(2,6,6) #define NVVER RHES4 #elif LINUX_VERSION_CODE KERNEL_VERSION(2,6,0) #define NVVER SLES9

Re: [c-prog] Re: glibc realloc bug?

2007-08-20 Thread Pedro Izecksohn
After I posted a buggy code and Thomas found the bug, Peternilsson42 wrote: C90 doesn't support mixed declarations and statements. A C90 compiler would not compile that code, but the bug was at runtime. Why some people use C90 compilers yet? In more serious projects, The

[c-prog] nftw problem

2008-01-25 Thread Pedro Izecksohn
Links: 1 Access: (0777/lrwxrwxrwx) Uid: ( 1000/ pedro) Gid: ( 1000/ pedro) Access: 2008-01-25 08:39:53.0 -0200 Modify: 2008-01-25 07:43:19.0 -0200 Change: 2008-01-25 07:43:19.0 -0200 [EMAIL PROTECTED]:~/programming/c/nftw_test$ stat test/sym\ of\ da File: `test/sym

Re: [c-prog] Need help sorting an array of structures

2008-01-25 Thread Pedro Izecksohn
--- ~Rick [EMAIL PROTECTED] escreveu: I am populating a number of entries and want to sort on the field linedata.transferPath. I'm using qsort and have built a comparator function but cannot figure out how to specify the transferPath element. But, I want to sort on an element within a

Re: [c-prog] problems porting 3D engine from windoze to linux

2008-01-26 Thread Pedro Izecksohn
First of many out of order answers: --- maxreason [EMAIL PROTECTED] wrote: 3: More code that used to compile/work (and does on windoze): const u08 MATH_AXIS_SHIFT_1 = 0x04; const u08 MATH_AXIS_SHIFT_2 = 0x08; const u08 MATH_AXIS_X = 0x01; const u08 MATH_AXIS_Y = 0x02; const u08

Re: [c-prog] problems porting 3D engine from windoze to linux

2008-01-26 Thread Pedro Izecksohn
--- maxreason [EMAIL PROTECTED] wrote: 2: From a linux C header file that I created a few years ago --- that I am fairly sure used to compile properly --- the following generate warnings and errors: typedef union vec004_64 { f64 af64[4]; struct { f64 x, y, z, w; };

Re: [c-prog] problems porting 3D engine from windoze to linux

2008-01-26 Thread Pedro Izecksohn
--- maxreason [EMAIL PROTECTED] wrote: 1: From an original software package I wrote long ago in another language, I could declare the value of an f64 AKA double precision floating point constant with: $$PI = 0d400921FB54442D18 where the 0d prefix says this is a double precision value

[c-prog] nftw bug

2008-01-26 Thread Pedro Izecksohn
None replied my previous post on this topic, even after I answered for two guys. Maybe none here care about Posix OSes. Today I saw the ntfw typo and, most important, Cygwin acts as I expected. I'll report the libc-2.7 bug in some minutes.

Re: [c-prog] problems porting 3D engine from windoze to linux

2008-01-30 Thread Pedro Izecksohn
--- bootstrap [EMAIL PROTECTED] wrote: typedef union { int64_t i; double d; } f64; No doubt about what you say, but this question remains. If f64 variables are now a structure-type rather than just an alias for double, what happens in the 58493 places where my code passes f64

[c-prog] Cygwin stat bug when dealing with symlinks.

2008-02-07 Thread Pedro Izecksohn
After many days breaking my head asking myself: -Why can't I write a simple program that work on Linux and on Cygwin? After thinking bad about glibc and hating the guy who invented symlinks: After short circuiting my Linux box 2 Ethernet cards; Finally you may look in the files section of

Re: [c-prog] C/C++ Interview Questions Book

2008-02-07 Thread Pedro Izecksohn
--- Thomas Hruska [EMAIL PROTECTED] escreveu: Paul Herring wrote: On Feb 8, 2008 12:47 AM, nitika_puri85 [EMAIL PROTECTED] wrote: Hi Firiends, First of all i am not spa!!! Debatable. He's on my spammers to ban list - he sent the same message three times. I'm not a

Re: [c-prog] Cygwin stat bug when dealing with symlinks.

2008-02-07 Thread Pedro Izecksohn
--- Brett McCoy wrote: Have you checked the CygWin website to see if anyone has run into this problem or if there is a workaround? I read FAQ. I expected someone here would point that I was wrong. Now I ftp ed a slightly different version and posted:

[c-prog] OT: ANN: sitage - Scale Index TAble GEnerator

2008-04-15 Thread Pedro Izecksohn
). Usage: sitage scale minimum increment maximum All as decimal floating point. increment must not be 0 . http://www.izecksohn.com/pedro/c/sitage/ Comments are welcome.

[c-prog] Re: scanf problem

2008-04-21 Thread Pedro Izecksohn
--- I wrote: scanf (%1s%*[\n], str); You could reply: Just delete the %*[\n] part and it'll work. But then: I did not understand in ISO/IEC 9899:1999(E) at §7.19.6.2 page 287 inside EXAMPLE 3 To accept repeatedly from stdin a quantity, a unit of measure, and an item name: what the

Res: [c-prog] Problem with Visual Studio C++ 6.0

2008-09-10 Thread Pedro Izecksohn
-- nayeret43 wrote: Hi, I tried to run this program: #include iostream.h main () { int x=25; float result; if (x!=0) { resul=1000/x; You forgot the last t of result. cout result; } } The code above does not follow the standard and

Res: [c-prog] printing the address of a variable using cout

2008-09-11 Thread Pedro Izecksohn
-- ~Rick [EMAIL PROTECTED] wrote: I am trying to print the address of a variable, not the contents of it. Using printf, I would say: printf(Allocated %ld bytes at %p\n, bsize+1, fbuf); but I want to use the C++ features using cout/cerr. I've tried the following but get garbage:

Res: [c-prog] printing the address of a variable using cout

2008-09-11 Thread Pedro Izecksohn
Even better: -- ~Rick [EMAIL PROTECTED] wrote: I am trying to print the address of a variable, not the contents of it. Using printf, I would say: printf(Allocated %ld bytes at %p\n, bsize+1, fbuf); but I want to use the C++ features using cout/cerr. I've tried the following

Res: [c-prog] Re: programmingsites???

2008-09-16 Thread Pedro Izecksohn
--- Thomas Hruska [EMAIL PROTECTED] wrote: Under that statement, we should all learn assembler, machine language, and maybe even leap backwards a few decades and use punch cards. :) I totally agree. My first language was C64 Basic and my second language was Assembly. After I learned

Res: [c-prog] Re: programmingsites???

2008-09-16 Thread Pedro Izecksohn
--- Nico Heinze [EMAIL PROTECTED] wrote: that a beginner will not be able to tell which sites are good and which are bad. And what about those sites where much information is good and only some (but pretty important things) are really bad and wrong? Can a newbie tell the difference? Or even

[c-prog] integer promotions

2008-11-22 Thread Pedro Izecksohn
If The integer promotions preserve value including sign. #include stdio.h int main (void) { unsigned short int a; unsigned long long int b, c; a = -1; b = (a*a); c = ((unsigned int)a*(unsigned int)a); printf (Why %llx != %llx ?\n, b, c); return 0; }

[c-prog] Re: integer promotions

2008-11-22 Thread Pedro Izecksohn
--- Tyler Littlefield wrote: and you want... what exactly? I did not express myself well. Let me reformulate my question: --- Paul Herring wrote: Here you're multiplying two shorts. What is the type of result of a multiplication of two unsigned short integers? In other words: Being:

[c-prog] Re: integer promotions

2008-11-22 Thread Pedro Izecksohn
--- Thomas Hruska wrote: The compiler is treating the resulting value as an unsigned integer because that is exactly what you told it to do with typecasting. OK, I wrote a bad piece of code. Let me try to codify my problem again: #include limits.h #include stdio.h int main (void) { unsigned

Res: [c-prog] Re: integer promotions

2008-11-23 Thread Pedro Izecksohn
--- Thomas Hruska wrote: BTW, you should have your compiler warnings turned up so that you get a warning for assigning a signed value to an unsigned variable. --- John Matthews asked: And anyone know the gcc equivalent? Gcc's -Wall 'all warnings' option doesn't include it. --- andrew

Res: [c-prog] util class for general method

2008-11-23 Thread Pedro Izecksohn
--- Jos Timanta Tarigan wrote: im planning to make a util.cpp file with some methods, and include the cpp file in every classes. but i wonder since i havent seen an included .cpp files(all included are header files) You should not include .cpp files in other .cpp files, but you should

Res: [c-prog] String and Numbers

2008-11-23 Thread Pedro Izecksohn
--- Mirza Abdullah Jan wrote: Hi I have text file in this pattern Jila Tim 45 45 67 5 67 45 3 5 67 89 19823456 Eva Clarare 42 1 8 43 52 76 1 8 90 43 19345678 - - Kim Jomte 4 5 75 24 52 52 35 35 36 35 19745432 I want to get name of each player and total higest score palyer. the

[c-prog] Re: integer promotions

2008-11-23 Thread Pedro Izecksohn
For peternilsson42: I was not clear and you did not read message 68798. http://tech.groups.yahoo.com/group/c-prog/message/68798 To clarify: That code I compiled on two independent compilers. On both compilers: USHRT_MAX is 0x UINT_MAX is 0x ULLONG_MAX is 0x For

Res: [c-prog] Re: integer promotions

2008-11-25 Thread Pedro Izecksohn
--- peternilsson42 wrote: So you made absolutely _no_ change to the semantics of that assignment! I fixed the signal to make others happy. You seem to be only interested in one class of machine. why do you think that? Or, do you think different values should be displayed? My previous

Res: Res: [c-prog] Re: integer promotions

2008-11-25 Thread Pedro Izecksohn
--- I wrote: It is mathematically obvious the Intel's approach. I thought it applied wherever it is possible. Correction: I thought the mathematically obvious approach would be applied wherever possible.

Res: Res: [c-prog] Re: integer promotions

2008-11-25 Thread Pedro Izecksohn
--- peternilsson42 wrote: Ah, then you've probably been fooled by the cliché that C is just portable assembler. If I could do just one modification to the standard, I'd add an overflow macro, like errno.

Res: Res: Res: [c-prog] Re: integer promotions

2008-11-25 Thread Pedro Izecksohn
--- I wrote: If I could do just one modification to the standard, I'd add an overflow macro, like errno. --- peternilsson42 replied: The behaviour on integer overflow is undefined. Hence, implementations already have the freedom to do precisely that if they so choose. [That they don't is

Re: Res: [c-prog] Re: integer promotions

2008-11-25 Thread Pedro Izecksohn
--- Thomas Hruska wrote: There would also have been warnings on the next line of code with the compiler complaining about a signed to unsigned conversion or something like that. That would have been the more useful clue to the OP that a weird conversion was happening behind the scenes.

Re: Res: [c-prog] Re: integer promotions

2008-11-27 Thread Pedro Izecksohn
--- peternilsson42 wrote: -Wconversion Warn for implicit conversions that may alter a value. ... Integral promotions don't alter the value. Maybe you need -Wsign-conversion gcc -Wall -Wsign-conversion problem.c -o problem cc1: error: unrecognized command line option

Re: Res: [c-prog] Re: integer promotions

2008-11-27 Thread Pedro Izecksohn
--- Thomas Hruska wrote: Try compiling your code as C++ and see if there is a difference. C++ compilers tend to generate a lot more warnings as the language is, generally-speaking, more strict. [EMAIL PROTECTED] ~/programming/c++/problem $ ls -la total 10 drwxr-xr-x+ 2 root None 4096 Nov

Res: [c-prog] Re: integer promotions

2008-11-30 Thread Pedro Izecksohn
--- peternilsson42 wrote: Maybe you need -Wsign-conversion gcc -Wall -Wsign-conversion problem.c -o problem cc1: error: unrecognized command line option -Wsign-conversion Time you updated then... % gcc --version gcc.exe (GCC) 4.3.2 Thank you.

Re: [c-prog] How OOP affect performance

2008-12-08 Thread Pedro Izecksohn
--- Jos Timanta Tarigan asked: im currently trying to convert a code from functional to OOP. but the program is performance sensitive kind of program. is it that significant to change from functional to OOP? how it will affect the programs performance(time and memory)? is it that much

Re: [c-prog] Re: Exception handling

2008-12-09 Thread Pedro Izecksohn
--- kocmotex wrote: ... the inability of academia to shift gears. After all, if some of the other free C compilers were taught, such as Pelles C, lcc-win32, Dev-C, etc, the academia might have to re-write some of their arcane quiries, such as triple pre-or-postfix notation, viz. +++y, c---,

Re: [c-prog] How OOP affect performance

2008-12-09 Thread Pedro Izecksohn
--- Jos Timanta Tarigan asked: i want those vertices become objects in triangles. Interesting new concept :) here is my question: is calling vertices[i].move() will take less time than calling triangle[i].vertices[k].move() ? well i know it will but is it that significant? I never

[c-prog] system's protection against buffer overflow

2009-04-13 Thread Pedro Izecksohn
Source code in: http://www.izecksohn.com/pedro/c/bo/bo.tar.gz Should static data be executable? I found that static data is executable on some platform.

[c-prog] Re: system's protection against buffer overflow

2009-04-13 Thread Pedro Izecksohn
I found that static data is executable on some platform. I was wrong. There is no reason for a constant string not be executable. It were not testing a writable static piece of memory.

[c-prog] trying to get rid of repeated values in an int array

2007-04-10 Thread Pedro von Wald
Hi, I posted here before, but unfortunately I had some issues going on and was unable to follow up the response. I really appreciate the responses, and apologize for the absence of a feedback. Now I writing a code whose (school stuff) whose goal is to deal with union, intersection and difference

[c-prog] processing a text file

2007-04-21 Thread Pedro von Wald
is that the file has multiple spaces between the words and at the end of lines, besides it also contains carriage returns . The whole code can retrieved at: http://rafb.net/p/e8phJy32.html thanks for any help, -pedro

[c-prog] Re: processing a text file

2007-04-22 Thread Pedro von Wald
--- In c-prog@yahoogroups.com, Victor A. Wagner Jr. [EMAIL PROTECTED] wrote: At 14:32 2007-04-21, Pedro von Wald wrote: I am working on the school proj, but I am having some difficult in processing the text file. Basically I am using the following to process the content of the file once

[c-prog] Re: processing a text file

2007-04-22 Thread Pedro von Wald
--- In c-prog@yahoogroups.com, Mickey Mathieson [EMAIL PROTECTED] wrote: --- Pedro von Wald [EMAIL PROTECTED] wrote: I am working on the school proj, but I am having some difficult in processing the text file. Basically I am using the following to process the content of the file

[c-prog] Re: processing a text file

2007-04-22 Thread Pedro von Wald
[x][x].erase(pos1,1); pos2=pos2+pos1; } } but it only removes in wherein there are two or three spaces, above that it does not work. --- In c-prog@yahoogroups.com, Pedro von Wald [EMAIL PROTECTED] wrote: --- In c-prog@yahoogroups.com, Mickey

[c-prog] filling a table with arrays

2007-04-23 Thread Pedro von Wald
Hello, I know that other languages would instructions such as locate(10,22) in order position elements on the screw, but it seems as if everything in C goes as a flow. I wrote a table in ascii, and like to be able to insert elements in it (cells). How could I do so, if possible (without having to

[c-prog] Re: filling a table with arrays

2007-04-25 Thread Pedro von Wald
Thanks for the info, Sam. I will check it out! -pedro --- In c-prog@yahoogroups.com, buxh42a [EMAIL PROTECTED] wrote: You should look up some information on Linked Lists. http://en.wikipedia.org/wiki/Linked_lists It will allow you to insert and remove from the middle of 'arrays'. Sam

  1   2   >