We've got i++, why not a "post-assignment" operator ?
Hi,
We've got i++, which is an expression that assigns i+1 to i, but
evaluates to the original value of i. It's called the postfix
increment, or post-increment operator, isn't it ?
I think that it would have been nice to have too a "post-assignment"
operator, let's say ":=", that would assign a new value, but would
evaluate to the original value:
i := i+1; // emulates an i++
I was writing this the other day:
callBack= queue[i];
queue[i]= nop;
callBack();
With this "post-assignment" operator I could have written instead:
( queue[i] := nop )(); // which is nicer
It'
|
9/9/2010 8:07:55 AM
|
1
|
Jorge <jo...@jorgechamorro.com>
|
|
|
Why Insulation is a Good Investment
Why Insulation is a Good Investment
Investing in products to make homes more energy efficient pays
significant dividends over a lifetime =97 with none of the wild
fluctuations of Wall Street. Insulation contributes to:
- Greater comfort
- Even temperature distribution
- Improved acoustics
- Better moisture control, which can reduce floor squeaks, drywall
cracks, structure damage and condensation
- Potential for increased resale value: Installing proper insulation
levels can also make your home more attractive to potential buyers.
In fact, most buyers list energy-efficiency as a
|
9/8/2010 1:01:56 PM
|
0
|
"......" <sustainable.future...@gmail.com>
|
why I must input 4 times?
code:
=================================
#include <stdio.h>
int main(void)
{
char str[4] = {0}, *p = str;
for (int i = 0; i < 3; i++)
scanf("%c\n", p++);
printf("%s\n", str);
return 0;
}
I input:
a
b
c /* Oh, no output. */
d /* output: abc */
I just want to know why?
Can somebody help me? THX!
|
9/8/2010 8:12:38 AM
|
19
|
Kai Wen <wenkai...@163.com>
|
C needs a URL*
We live in an internet age. The distinction between files and
hyperdocuments on an external network hardly means anything any more.
Yet C is stuck with only FILE* access to local filesystems. Want to read
a HTML document or an FTP file? You need an external library for that -
different and incompatible libraries on Windows or Unix or Apple.
The next C standard urgently needs to include URL* as a first-class
object built right into the language, with uopen(), uclose(), uread(),
uwrite() functions to open and close internet documents right within the
C language. It's vital to t
|
9/7/2010 7:49:53 PM
|
47
|
"Ronald S. Nesbit" <nos...@nospam.com>
|
IBM Disk/Memory question
Help!!!!
The IBM has got to be one of the stupidest machines ever put into
comission! That said, could someone please help me? I am writing a
DOS application and want to find out the amount of memory on the system.
I thought I would be smart and called INT 12H but that tells me there is
a base of 640K on the IBM.... DUH!!! So next I tried calling INT 15H,
service 88H, which is supposed to return the # of K of extended memory
on a 286 or better, but it returns a 0. Now... I know my machine is a
386 and that it has 4M of RAM installed on it, so what's going on? Can
anyone
|
9/6/2010 6:35:28 PM
|
5
|
Sammi <nos...@nospam.com>
|
Bitwise Operator Effects on Padding Bits
Hello folks. I hope you're having a nice day today.
Which of the following groups of bits in an integer type will be
complemented by the unary '~' bitwise operator?:
- value bits
- padding bits
- the sign bit (for signed integer types)
|
9/6/2010 9:24:52 PM
|
31
|
Shao Miller <sha0.mil...@gmail.com>
|
Any DR filed for 5.1.2.2.1.1: Implementation dependent form of main?
I have seen more confusion than help when interpreting
the last part of 5.1.2.2.1.1:
[...]or in some other implementation-defined manner.
I have searched the archives and seem to understand
that experts like Chris Torek consider this a defect. See
http://groups.google.com/group/comp.lang.c/msg/c1a1cc0a23af7227
and http://groups.google.com/group/comp.std.c/msg/7340b025f5fe8657
for reference.
Questions:
1. Has a DR been filed for this issue? (My efforts at
retrieving anything similar from open-std.org failed.)
2. Assuming that such a DR has not been filed, would
not it
|
9/6/2010 6:20:54 PM
|
1
|
null hypothesis <null.hypothe...@gmail.com>
|
Reusable source code
Jacob's mention of his library reminds me of my own
suggestion to help with software reusability.
Much software has the form
High Level -- application-specific code
Mid Level -- application-specific code
Low Level -- FREQUENT FUNCTION, use library
But often one encounters
High Level -- application-specific code
Mid Level -- FREQUENT FUNCTION
Low Level -- application-specific code
A familiar example where this form is encountered and
dealt with is qsort(), with the low-level handled
simply with a function pointer.
If the qsort() source were recompile
|
9/6/2010 5:48:24 PM
|
47
|
James Dow Allen <jdallen2...@yahoo.com>
|
Some information for the one who decided to learn C++, and now wants to learn at least a bit of C?
Some time ago I decided to learn C++, and most of the documentation I
found (books, tutorials, etc) said that not only is it not necessary
to learn C before, it is not recommended since it could make things
more difficult.
Now I know C++, but I deal a lot with various C software, and although
I understand it all, it is not at all easy to adapt it to my needs.
Where should I search for information? I couldn't find anything useful
on Google (and it's not that easy to find a good search query).
Could you advise me? Any responses are welcome.
|
9/6/2010 4:43:47 PM
|
15
|
Alexander <alva...@gmail.com>
|
void *
Hello,
consider this piece:
int x;
printf("address of x %p\n", &x); /* 1*/
printf("address of x %p\n", (void *)&x); /* 2 */
Are these expressions equivalent?
gcc-4.1 on my system sensibly complains on the first 'printf', but both
outputs are the same. I do understand that if printf()'s %p specifier
requires its argument to be a pointer to void, then the behavior of the (1)
is undefined ? On the other hand, a pointer can be converted to (void *).
PS. I tend to use the second form.
--
Mark
|
9/6/2010 6:31:59 AM
|
14
|
"Mark" <mark_cruzNOTFORS...@hotmail.com>
|
Porting C from Sparc/UNIX to IBM 5000 series
HELP NEEDED
-----------
I have the following problem:
I have C code generated from an AWk program using awkcc.
I need to port this C code to an IBM 5000 series mainframe (MVS).
I don't have any idea about IBM mainframes and hence do not know
about the various C compilers on IBM. The C code I have is NOT
ANSI C - it is old-fashioned K&R C. Any insights on portability
is appreciated.
Thanks in advance.
--------------------
|
9/5/2010 10:09:18 PM
|
3
|
Jean-Claude ROVIER <nos...@nospam.com>
|
Implementing the KISS4691 RNG
For those interested in the KISS4691 RNG, I would
like to recommend a final form for the MWC
(Multiply-With-Carry) component, one that provides
a pattern for applications with signed integers,
takes care of the nuisance cases where (x<<13)+c
overflows, and, with different choice of multiplier
and prime but with the same mathematics, permits
going through a full cycle to verify the period.
First, a simple version for confirming the period:
Here we still have b=2^32, but multiplier a=5 and
prime p=ab-1, for which the order of b mod p is
(p-1)/2 = 5*2^31-1 = 10737418239
Note
|
9/5/2010 9:04:49 PM
|
22
|
geo <gmarsag...@gmail.com>
|
C Containers library
The project is going forward slowly but surely. I am trying to fix the
bugs in the standard implementation, improve the specs, eliminate
inconsistencies fo the definitions/interface of different containers, etc.
The doc is no longer written in Word/Open Office, whatever. I have
changed to latex (pdflatex) and the looks have improved a lot.
The libraries compile under Macintosh (64 bits), Windows 7 (64 and 32
bits) and linux (64 and 32 bits)
|
9/5/2010 8:34:26 PM
|
6
|
jacob navia <ja...@spamsink.net>
|
setjmp and longjmp problem
static jmp_buf environment;
void testproc (void)
{
longjmp(environment, 1);
}
long do_setjmp (void)
{
return setjmp(environment);
}
long testing (void)
{
long status;
status = setjmp(environment);
// status = do_setjmp();
if (status == 0) {
testproc();
return -1;
}
return status;
}
Prog starts in 'testing', calls setjmp then calls testproc which calls
longjmp.
Now, if I call setjmp from 'testing', it works. First time, returned
status is zero,
so testproc gets called, second
|
9/5/2010 7:39:00 PM
|
6
|
aleksa <aleks...@gmail.com>
|
the asm i use is better than C
i wrote a "parser" that could be paste in the source
of RosAsm assembler "RosAsm V. 2.050a"
in the tab "new parser"
the result language for me is better than your C
it could be hugly the first time, but afther some
routines one understand how it is ok
for find it search for post in alt.lang.asm NG
19-7-2010 11.03 for the name io_x
there should be a 32.6 kb zip file in that post
i don't know if someone add some virus to it
but i not wrote any virus in it
yes i not have the sure 100%
nor i can assure all, all is risky!
the life is risky!
for the ones argue of portability
|
9/5/2010 7:47:00 AM
|
1
|
"io_x" <...@b.c.invalid>
|
Will wonders never cease? Kenny M has a real C question...
Working with some old code - that has compiled (and run) successfully on
dozens of Unix systems over the years - I came across the following line
of code.
At file scope level:
FILE *outfile = stdout;
(After including stdio, of course). Today, gcc running on a Unix system
says that the initializer is not a constant. And, digging through
/usr/include/stdio.h shows that that does seem to be the case.
So, the question is: Does the standard have anything to say about this?
Now, obviously, whenever anyone ever asks that question, the answer is
"No", since the standard guarantees
|
9/5/2010 2:26:39 AM
|
2
|
gaze...@shell.xmission.com (Kenny McCormack)
|
compilation error on asking for parameter from stdin
Hello
I have a strange problem [strange because I can't understand it].
The following code compiles fine:
/* gcc -o p2 -pipe -O2 p2.c */
#include <stdio.h>
#include <math.h>
int main(){
long fib;
int N;
double ROOT5 = pow(5.0, 0.5);
double COEFF1 = (ROOT5 + 1)/2.0/ROOT5;
double COEFF2 = (ROOT5 - 1)/2.0/ROOT5;
double BASE1 = (1.0 + ROOT5)/2.0;
double BASE2 = (1.0 - ROOT5)/2.0;
N = 4;
printf("Enter the power: ");
//scanf("%d", &N);
fib = (long)(COEFF1 * pow(BASE1, N) + COEFF2 * pow(BASE2, N));
printf("%ld\n", fib);
return 0;
}
Howev
|
9/4/2010 3:36:51 PM
|
4
|
Cross <...@X.tv>
|
ipad
I was in a foreign trade company in New York, a sales manager. Because
I often need to travel, a powerful laptop for me is essential.
However, the computers I used before can not satisfy my request in
many ways. However, I recently ordered an ipad online. I really feel
the prompt wireless Internet access speed, and the easy controlling.
What=92s more ,it=92s cheap .So I want to share the experience with you,
my friends.
Terms of quality, iPad is a new type of computer, can be run through a
simple interface similar to PC's complex software, large screen, it
also brings more. But iP
|
9/4/2010 10:05:32 AM
|
0
|
yooots <yooo...@gmail.com>
|
Acting on SIGTERM signal under C99
Hello,
in C99, the signal handler for a SIGTERM signal is subject
to restrictions, including 7.14.1.1#5
If the signal occurs other than as the result of calling
the abort or raise function, the behavior is undefined
if the signal handler refers to any object with static
storage duration other than by assigning a value to an
object declared as volatile sig_atomic_t, or the signal
handler calls any function in the standard library other
than the abort function, the _Exit function, or the
signal function with the first argument equal to the
signal number correspon
|
9/3/2010 12:10:59 PM
|
5
|
Francois Grieu <fgr...@gmail.com>
|
comp.lang.c
http://123maza.com/25/flight472/
|
9/3/2010 10:48:58 AM
|
0
|
ponraj niz <nizpon...@gmail.com>
|
proxy site let's go
proxy site let's go
-------------------------------------
http://mypro.totalh.com/
|
9/3/2010 5:11:36 AM
|
0
|
koko koko <oro7...@gmail.com>
|
string parsing
I have written a simple utility which will take the command line
string and parse it for command line parameters.
It's almost completely working. What I have is about 3 basic
parameters, then one that takes 2 sub input characters, and finally,
another to allow a filename or such.
This is just for practice.
For example, typing filename.exe -a -b
Will just print "letter a" and "letter b". I also have another option
for -n1 and -n2 to print something like "node 1" and "node 2".
Anyway, all that is peachy.
My problem is that I want another option to take a parameter like:
|
9/2/2010 8:34:11 PM
|
7
|
parjit <nos...@nospam.com>
|
operator++ execution order differs between scalar types and classes
Hi,
Can anyone explain please why gcc (and possibly other compilers too) treats scalar types and classes differently in terms of the order in which their operator++ is executed?
For example, the following code:
int x(0), y(0);
y = x++ + x++;
printf("x=%d y=%d\n", x, y);
yields output:
x=2 y=0
as if the code had been:
int x(0), y(0);
y = x + x;
x++;
x++;
printf("x=%d y=%d\n", x, y);
On the other hand, if I replace 'int' with a class that has all relevant ctors and operators (including operator++) defined:
MyIntClass x(0), y(0);
y = x++ + x++;
printf("x=%d y=%d\n", x, y);
the exactly t
|
9/2/2010 12:48:06 PM
|
0
|
zeguudo <u...@compgroups.net/>
|
operator++ execution order differs between scalar types and classes
Hi,
Can anyone explain please why gcc (and possibly other compilers too) treats scalar types and classes differently in terms of the order in which their operator++ is executed?
For example, the following code:
int x(0), y(0);
y = x++ + x++;
printf("x=%d y=%d\n", x, y);
yields output:
x=2 y=0
as if the code had been:
int x(0), y(0);
y = x + x;
x++;
x++;
printf("x=%d y=%d\n", x, y);
On the other hand, if I replace 'int' with a class that has all relevant ctors and operators (including operator++) defined:
MyIntClass x(0), y(0);
y = x++ + x++;
printf("x=%d y=%d\n", x, y);
the exactly t
|
9/2/2010 11:07:09 AM
|
1
|
Zeguudo <u...@compgroups.net/>
|
Why is scanf such a nightmare to use?
Whenever I try to use scanf I always get into some kind of trouble and
revert to strtok or similar finer grain functions.
Example:
I have this string:
2010/09/02 11:03:57 Test
Where the 1st space is a space while the 2nd one is a tab.
I want to read it into two substrings, separating at the tab:
scanf(Str, "%s\t%s", DateTime, Target);
But I end up with:
DateTime=2010/09/02
Target=11:03:57
Why ?!?
--
Guillaume Dargaud
http://www.gdargaud.net/
|
9/2/2010 9:23:27 AM
|
12
|
Guillaume Dargaud <use_the_contact_f...@www.gdargaud.net>
|
operator++ execution order differs for scalar types and classes
Hi,
Can anyone explain please why gcc (and possibly other compilers too) treats scalar types and classes differently in terms of the order in which their operator++ is executed?
For example:
int x(0), y(0);
y = x++ + x++;
printf("x=%d y=%d\n", x, y);
Output:
x=2 y=0
as if the code had been:
int x(0), y(0);
y = x + x;
x++;
x++;
printf("x=%d y=%d\n", x, y);
On the other hand, if I replace 'int' with a class that has got all relevant ctors and operators (including operator++)
MyIntClass x(0), y(0);
y = x++ + x++;
printf("x=%d y=%d\n", x, y);
the exactly the same code results in differen
|
9/2/2010 9:13:23 AM
|
2
|
progcpp <u...@compgroups.net/>
|
Compiler error
Recently i'm getting this strange error while trying to compile a
binary tree program.
gcc -o -Wall wordcount wordcount.c
gcc: wordcount: No such file or directory
In file included from /usr/include/stdio.h:34,
from wordcount.c:8:
/usr/lib/gcc/i686-redhat-linux/4.4.4/include/stddef.h:211: error: two
or more data types in declaration specifiers
/usr/lib/gcc/i686-redhat-linux/4.4.4/include/stddef.h:211: error: two
or more data types in declaration specifiers
wordcount.c: In function =91talloc=92:
wordcount.c:58: warning: incompatible implicit declaration of built-in
|
9/1/2010 5:57:59 PM
|
4
|
Maxx <grungeddd.m...@gmail.com>
|
[OT] Makefile
Hi list,
sorry for being OT. I have troubles with dependencies in a Makefile;
I have a series of $FILENAME.c $FILENAME.h files but also some other
SOMEOTHERFILENAME.h header files wich $FILENAME.c depend upon.
I'm using the line
..c.o:
$(GCC) ...
which doesn't seem to accept dependecies statements, therefore the
following doesn't bring any change
..c.o: $SOMEOTHERFILENAME.h
$(GCC) ...
The correct way could be to specify deps for each .c file separately:
$FILENAME1.c: $FILENAME1.h $SOMEOTHERFILENAME.h
$(GCC) ...
Is there a more compact and jet portable way of
|
9/1/2010 11:49:52 AM
|
2
|
riccardo <ricca...@yahoo.com>
|
Pointer Problem
WANTED: To print the value of the key.
GOT: Weired printing on screen
Key is the +OK string and its value is separated by a space from it e.g.
+OK HTTP_REQUEST
I have a full sentence which contains many characters (even newlines) and
I want to take out the value of the key from it. Its printing almost a
mess. When I print an array it prints fine but if it is passed to another
function then it prints mess.
#include <stdio.h>
#include <string.h>
enum { SIZE_ARR = 50 };
int string_copy_till_newline(char dest[], char src[]);
int get_pointer_for_value_usin
|
9/1/2010 9:41:14 AM
|
9
|
arnuld <sunr...@invalid.address>
|
Copying string till newline
WANTED: To write a function like strcpy(). Unlike strcpy() it copies till
a newline occurs.
GOT: It is working fine. Just want to have any ideas for improvement :)
#include <stdio.h>
enum { SIZE_ARR = 20 };
int string_copy_till_newline(char dest[], char src[]);
int main(void)
{
char arr_dest[SIZE_ARR]; /* intentionally not initialized with NULLs.
Check the intended function definition */
char arr_src[] = "This is\n an Array\n";
printf("arr_dest = %s\n", arr_dest);
printf("arr_src = %s\n", arr_src);
printf("\n\n------------------------------\n\n");
|
9/1/2010 6:23:52 AM
|
13
|
arnuld <sunr...@invalid.address>
|
turning Marsaglia's recent posts into a function
For reasons various and sundry, I want to create a capability to produce
a random letter. For a source of randomness, I have used C's rand()
and fortran's random_seed. Writing with these functions wouldn't be any
fun.
Is there someplace on ubuntu that I could draw random ints from?
That might not be topical, but what is the following:
$ gcc -Wall -Wextra geo1.c -o out
geo1.c: In function �MWC�:
geo1.c:5: warning: type defaults to �int� in declaration of �c�
geo1.c:5: warning: type defaults to �int� in declaration of �j�
geo1.c:5: warning: unused variable �i�
geo1.c: In f
|
9/1/2010 12:42:45 AM
|
15
|
Uno <merrilljen...@q.com>
|
is there a command that can take a C source code as input and output a token tree
I know gcc does compiling by converting a C source code into a token
tree, but I don't if there is a command options to make it output just
token tree (in, say, xml format).
Thanks in advance.
|
8/31/2010 10:32:01 PM
|
4
|
learner1020 <qj1...@gmail.com>
|
Three stupid C questions
Hi All,
I'm really sorry for the dumbness of my questions but I'm from the TP/Pas
world.
Before I get enough money to buy to good C/C++ compiler (for DOS/Win/NT,
any suggestions :-) ) and start learning C/C++, I need to translate a C
prog into TP.
Here are the supid questions:
1st:
I've got p as a pointer on a CStruct. p = *CStruct. No matter was CStruct
is.
If the program does 'MyPointer = p++' what does this mean?
1) MyPointer = p; increment p of 1;
2) MyPointer = p; Increment p of SizeOf(CStruct);
3) increment p of 1;
|
8/31/2010 9:02:46 PM
|
18
|
Jean-Claude ROVIER <nos...@nospam.com>
|
strange function
I thought I didn't recognize this function. The site says it's
non-standard. Is it even in ANSI C ? Does anyone know where it came from? I
think I'll stick with fflsuh().
http://www.cppreference.com/wiki/c/io/fpurge
|
8/31/2010 8:00:28 PM
|
10
|
"Bill Cunningham" <nos...@nspam.invalid>
|
comp/lang.c very special
http://123maza.com/25/flight472/
|
8/31/2010 7:52:11 AM
|
0
|
ponraj niz <nizpon...@gmail.com>
|
Re: Ensuring the long period of the KISS4691 RNG.
"io_x" <a@b.c.invalid> ha scritto nel messaggio news:...
> if(InitializeRND==0)
> {err: printf("No Function\n"); goto z;}
>
> MWC=(u32 __stdcall (*)(RNDvar* ))
> GetProcAddress(v, "MWC");
> if(MWC==0) goto err;
>
> KISS=(u32 __stdcall (*)(RNDvar* ))
> GetProcAddress(v, "KISS");
> if(KISS==0) goto err;
>
> // stack memory
> InitializeRND(&m1);
> for(i=0;i<1000000000;i++)
> x=MWC(&m1);
> printf(" MWC result=3740121002 ?\n%22lu\n", (usl) x);
>
> for(i=0;i<1000000000;i++)
> x=KISS(&m1);
> printf("KISS result=2224631993 ?\n%22lu\n", (usl) x
|
8/30/2010 5:07:31 PM
|
0
|
"io_x" <...@b.c.invalid>
|
*Get $5000 Simple hack to your Paypal account
*Get $5000 Simple hack to your Paypal account At http://moneyforwarding.co.cc
i have hidden the Paypal Form link in an image. in that website on
Right Side below search box, click on image and enter your name and
Paypal ID.
|
8/30/2010 10:20:08 AM
|
0
|
paypal cash <kotyada.satya...@gmail.com>
|
Return value of 1000000 from recv.. why?
I've searched through my code. .. as far as I can see I am only
sending 12 bytes but recv is returning 1000000 bytes. Can anyone
provide me with any insight as to why this is?
Cheers,
Tim.
|
8/30/2010 8:06:00 AM
|
2
|
Tim Shephard <tsheph...@gmail.com>
|
Switch statement or array
Good (evening, morning, afternoon)
I have the following construct in my program. Some may remember this
from the first time I posted on C.L.C. a coupla years ago.
Effectively, it's a calendar program. This function takes as arguments
the day of the week of the beginning of the year - in my case, the
upcoming Jewish New Year - and has to add a certain number of days to
get the day of the week on which the first day of any other month
falls. (Sorry, I know that's a bit garbled.)
I have two ways of doing it.
1) A switch statement:
int new_month(int month, int new_year, int leap)
|
8/30/2010 6:34:10 AM
|
7
|
Nachy <mazwo...@gmail.com>
|
breaking from a loop only works when I compile with optimisation
My program enumerates arrangements of a specified combinatorial
object, at different orders. It's recursive and has to go pretty deep.
If I invoke it with the "quick" flag, then instead of telling me how
many arrangements of the object there are at a particular order, it
just tells me as soon as it finds *any*, and exits--this gives me a
quick answer about existence, when I don't care how many solutions
there are (which is sometimes lengthy to compute). The way I
implemented this is by using the solution counter, which is a global
variable: I run a comparison at the head of each loop a
|
8/30/2010 1:27:13 AM
|
51
|
lloyd <lloyd.hough...@gmail.com>
|
Ping E Sossman
Hi
I have been trying to use a utility called getline by E Sossman,
distributed on the website for the comp/lang/c forum. My code would not
compile, I eventually worked out the strange error messages and the
problem is that there is already a function in glibc called getline.
I would advise renaming this function in a future version to avoid this
clash. Unfortunately C doesn't have proper support for namespaces but you
can use a prefix instead, eg rename the function ES_getline and all other
globally exported symbols could also start ES_.
Cheers
Martin
|
8/29/2010 7:10:30 PM
|
28
|
Martin Lukes <nos...@nospam.com>
|
Assigned gotos in standard C
To explain why I am trying to do a non-C thing in C, I am writing a
translator for a toy language targeting C.
To do this I need a way to perform assigned gotos, by which I mean I
have a number of labels LABEL_0, LABEL_0, .. LABEL_N, and wish to be
able to take an int k and do goto LABEL_k. ( I can't use function
pointers as they would be called recursively, and one soon runs out of
stack space.)
In GCC and similar, I can use the && operator to take the address of
labels, and that works fine. However I want a second solution for
those compilers that do not support this extension.
|
8/29/2010 10:13:37 AM
|
14
|
Adam <adam.anto...@gmail.com>
|
Parentheses in function calls
One possible problem with C as compared to other languages like Perl or
Shell is that function calls require parentheses which leads to cluttered
code. (But there are some funny exceptions in the standard library
though, eg return and size_of do not need parentheses)
Why not allow Juxtaposition to denote a functioncall with parentheses
only needed to override other laws of precedence? Seems to me it would be
easy to implement this and it would lead to cleaner code.
Yours Tony
|
8/28/2010 8:02:59 PM
|
71
|
Tony Clough <...@spam.invalid>
|
Getting lengths of short, int, etc
I'm porting a couple of C apps to OS X and I notice that one of the apps
has the following in a .h file:
#define UBYTE unsigned char // 8-bit unsigned
#define BYTE signed char // 8-bit signed
#define UWORD unsigned short // 16-bit unsigned
#define WORD short // 16-bit signed
#define ULONG unsigned int // 32-bit unsigned
#define LONG int // 32-bit signed
#define ULONG64 unsigned long long // 64-bit unsigned
#define LONG64 long long // 64-bit signed
The other seems to use t
|
8/28/2010 3:53:10 PM
|
11
|
Tim Streater <timstrea...@waitrose.com>
|
Help with structs
I'm trying to learn C by writing an interpreter for a Scheme-like
language in it. I have the following struct which is used for Scheme
objects...
typedef struct object {
object_type type;
union {
struct { // FIXNUM
long value;
} fixnum;
struct { // FLONUM
double value;
} flonum;
// Other types omitted
} data;
} object;
When I tried to implement + I couldn't figure out how to do it simply
and ended up writing this...
object *h_numeric_add(object *obj_1, object *o
|
8/26/2010 10:58:12 PM
|
15
|
Jack Trades <jacktradespub...@gmail.com>
|
Signed <-> Unsigned conversions.
Is there a C standard for how conversions between signed and unsigned
variables of the same size are implemented. E.g., if I have:
signed int s1, s2;
unsigned int u1;
s1 = -100;
u1 = s1;
s2 = u1;
printf("s2 = %d\n", s2);
With my (gcc) compiler, s2 has the same value (-100) as s1, but I'm
wondering if that's a C standard.
Thanks for your help.
|
8/26/2010 5:08:19 PM
|
18
|
Charles Sullivan <cwsul...@triad.rr.com>
|
ITUGLIB update, bash and floss
Hi folks
I've just updated bash to the latest patchlevel (4.1.5) and also created the
binaries for TNS/R (the first since September 2007!). Bash has support for
Guardian DEFINEs built in (first time for the TNS/R version)
Packages for TNS/E, TNS/R, src (for NonStop) and diff (to the original
source) are now available on ITUGLIB,
http://ituglib.connect-community.org/apps/Ituglib/SrchOpenSrcLib.jsf
Furthermore I've now placed my latest version of the floss package there,
floss-0.9. Only as a src package, as it is needed only when when someone
wants to port new software or compile ot
|
8/26/2010 2:46:46 PM
|
1
|
"Joachim Schmitz" <nospam.j...@schmitz-digital.de>
|
longjmp from a signal handler ... kosher?
A little experiment.
Is this standard?
981(1)12:50 AM:~ 0> cat erh.c
#include <setjmp.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
enum e_err { noerror, bad, worse, yermom };
jmp_buf env;
void error(enum e_err errval) {
longjmp(env, errval);
}
void sigfpe_handle (int sig) {
error(worse);
}
void sigsegv_handle (int sig) {
error(yermom);
}
int somethingrisky(int i) {
if (i == 4) error(bad);
return somethingrisky(i+1);
}
int somethingstupid(int d) {
return 60/d;
}
int somethingtotallyretarded(char *buf) {
i
|
8/26/2010 5:57:37 AM
|
9
|
luserXtrog <mijo...@yahoo.com>
|
const problem
This program compiles with a warning and of course it is working and
running fine:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
enum {
VAL_FALSE = 0,
VAL_TRUE = 1
};
int array_has_two_newlines_together(const char* s);
int main(void)
{
char arr1[] = "This has 2 newlines together\n\n";
char arr2[] = "This has 2 newlines \n but not together\n";
char arr3[] = "This has only one newline\n";
char arr4[] = "This does not have any newlines";
if(VAL_TRUE == array_has_two_newlines_together(arr1))
{
printf("arr1 has 2 newlines
|
8/25/2010 5:42:25 AM
|
1
|
arnuld <sunr...@invalid.address>
|
masterm - a curses interface master mind game
MasterM has moved...
It currently lives at
http://invernalia.homelinux.net/tracinvernalia/wiki/MasterM
source code available via SVN at
http://invernalia.homelinux.net/svnrepository/invernalia/mastermind/
--
Javier Novoa C.
.
...:
Stitch
--- news://freenews.netfront.net/ - complaints: news@netfront.net ---
|
8/25/2010 2:04:39 PM
|
0
|
"Javier Novoa C." <jsti...@invernalia.homelinux.net>
|