comp.lang.c
  Home FAQ Contact Sign in
comp.lang.c only
 
Advanced search
December 2007
motuwethfrsasuw
     12 48
3456789 49
10111213141516 50
17181920212223 51
24252627282930 52
31       1
2007
 Jan   Feb   Mar   Apr 
 May   Jun   Jul   Aug 
 Sep   Oct   Nov   Dec 
2008 2007 2006  
total
comp.lang.c Profile…
RELATED GROUPS

POPULAR GROUPS

more...

 Up
  SHA-1 in fully-portable C89?         


Author: Tomás Ó hÉilidhe
Date: Dec 31, 2007 19:31

(SHA-1 is a cryptographic hash function. For info on what SHA-1 is:
http://en.wikipedia.org/wiki/SHA-1)

I'm writing fullportable C89 code that needs to make use of the SHA-1
algorithm. Does anyone know if there's been a fully-portable C89
implementation of the SHA-1 algorithm?

If not, could someone please point me to a very good implementation of the
algorithm, an implementation which is very portable (perhaps portable to
machines with 8-Bit bytes and which have exact 16-Bit, 32-Bit and 64-Bit
integer types)?

I've done a few Google searches but I'm getting back a lot of sub-standard
platform-specific code.

Thanks.

--
Tom
20 Comments
  What's the deal with "long double"         


Author: bananaguyc
Date: Dec 31, 2007 16:47

Okay, I'm running the following code in GCC 4.1.2:


int main(void)
{
long double test = 4.67e-4;
printf("float: %%f e-notation: %%e\n", test, test);

return 0;
}

I'm expecting something like the following results:
float: 0.000467 e-notation: 4.67000e-05

but instead, I get the following results:

float: -694415276597203906161323291068799052712651627473832627705136406154899829233891145764324516731136584994939249352577342742286164740704820047241658318432036343997321168388142931399907787574462172995952462873006898981791706009191971315944784829937771849187328.000000 e-notation: 4.802997e+149

What exactly is the issue here?

I'm using GCC 4.1.2 on an Intel p3, if that matters.
5 Comments
  Stats for comp.lang.c (last month)         


Author: CLC stats
Date: Dec 31, 2007 15:06

============================================================================
Analysis of posts to comp.lang.c
============================================================================
(stats compiled with a script by Garry Knight)

Total posts considered: 4,640 over 31 days
Earliest article: Sat Dec 1 20:08:02 2007
Latest article: Mon Dec 31 23:04:01 2007
Original articles: 376, replies: 4,264
Total size of posts: 11,233,822 bytes (10,970K) (10.71M)
Average 149 articles per day, 0.35 MB per day, 2,421 bytes per article
Total headers: 5,189 KB bodies: 5,780 KB
Body text - quoted: 2,629 KB, original: 2,604 KB = 49.76%%, sigs: 526 KB
Total number of posters: 567, average 19,812 bytes per poster
Total number of threads: 464, average 24,210 bytes per thread
Total number of User-Agents: 55

============================================================================
Top 20 posters by number of articles
==================================================================...
Show full article (5.09Kb)
1 Comment
  What does this mean?         


Author: brettcclark
Date: Dec 31, 2007 13:18

This define is from the Vista SDK from propidl.h:

#ifdef __cplusplus
#define REFPROPVARIANT const PROPVARIANT &
#else
#define REFPROPVARIANT const PROPVARIANT * __MIDL_CONST
#endif

and again in propkeydef.h:

#ifdef __cplusplus
#define REFPROPERTYKEY const PROPERTYKEY &
#else // !__cplusplus
#define REFPROPERTYKEY const PROPERTYKEY * __MIDL_CONST
#endif // __cplusplus

OK, so I know what PROPVARIANT and PROPERTYKEY are, but I'm afraid
that I don't understand what REFPROPVARIANT and REFPROPERTYKEY refers
to.
What exactly is being defined? How does REFPROPVARIANT and
REFPROPERTYKEY relate to the original PROPVARIANT and PROPERTYKEY,
respectively. I've not seen this same syntax before.
Show full article (0.72Kb)
4 Comments
  References and pointers         


Author: Simon Saize
Date: Dec 31, 2007 10:31

Hi -

What's the point of having references (&)? Why don't we just use
pointers (*)?

Thanks.
63 Comments
  Table based programming.         


Author: Malcolm McLean
Date: Dec 31, 2007 08:43

I want this to be a serious, fruitful thread. Sabateurs will be plonked.

Table-based programming is a new paradigm, similar to object-orientation,
procedural decomposition, or functional programming.

The idea is that all the data in the program comes in "tables". A table
consists of records and fields, and is thus a 2d entry. Fields may be
numbers or strings, and have names, descriptors, prevalidation conditions
and postvalidation conditions, and the like.
Note that this means that each field in the table is described by a "data
dictionary" which is itself a table, with one record for each field.

Tables are completely transparent to disk caching, sharing, database
support, and the like. They can have tiny of massive numbers of records.

There are no other structures. Queues, stacks, trees and the like are things
that you do to tables, not the format that the table is in. The idea is
that, given a dictionary, you can write automatic editors, viewers, savers
and things like that. So most code can be reused. They are designed with
business applications in mind, but could be used more broadly.

Now obviously C is not a "table-based programming language" and has no build
in support. However paradigms are independent of the language they are
implemented in.
Show full article (1.43Kb)
15 Comments
  How to deal with big-size files??         


Author: åäÃÇæì
Date: Dec 31, 2007 07:59

What can i do to open , write and seek in file with size 2 GB or more

I know that you r limited with int type size which is 32-bit but how
programs like gzip , zip read and write from files with big size like
2-GB

how can i break this limit in C or even C++
9 Comments
  Redirect stdin ?         


Author: Lothar Behrens
Date: Dec 31, 2007 05:40

Hi,

I have a c application (Lex&Yacc based) that parses from stdin. I want
to rewrite the code
a bit to allow reading the source from a char array instead from stdin
without touching the
lex and yacc generated source code.

How could I do that ?

What is about the problem when the buffer is too big to feed the
source to the parser at once ?

Any ideas ?

Thanks, Lothar
6 Comments
  Uninitialised fields in structures         


Author: Ulrich Eckhardt
Date: Dec 31, 2007 02:58

Greetings!

I was recently surprised by the compiler's warning concerning this code:

struct text {
char* s;
size_t len;
};
int main() {
struct text t = {"hello world!"};
}

The compiler actually claimed that t.len was uninitialised. Okay, I don't
explicitly initialise it, but I was under the impression that it should be
initialised to zero then (i.e. all fields after the last one are
initialised with zero). Okay, it's just a warning, so I tended to ignore
it. Now, when I ran the code through Valgrind, it also complained that an
uninitialised value was used, which got me thinking. Lastly, I used gdb to
step through the code and explicitly shredded the value of t.len before
that line and - lo and behold - it was correctly (IMHO) reset to zero!
Show full article (0.96Kb)
12 Comments
  function returning days of the week         


Author: ssylee
Date: Dec 31, 2007 01:10

I need to write a function that would read in a byte that would return
a number between 1 to 7, 1 being Sunday, 2 being Monday, etc. I want
to return an actual string that says "Sunday", or "Monday", etc.
corresponding to the number. I know that the best method to implement
a lookup conversion table would be using switch(variable ) ... case
x: .... structure. However, I may need to pass an array as one of the
parameters in order to access the text itself. Is there anything
inefficient in passing a character array as a parameter based on
memory consumption on an embedded microprocessor system? Thanks.
29 Comments
 
1 2 3 4 5 6 7 8 9