HNHacker News
TopNewBestAskShowJobs

DougGwyn

91 karma · joined April 13, 2020

submissionscomments
DougGwyn··on Tell HN: C Experts Panel – Ask us anything about C
It has been many years since a C++-to-C preprocessor has been commonplace. There's just too much new stuff in recent C++ to map it all easily into straight C.
DougGwyn··on Tell HN: C Experts Panel – Ask us anything about C
Since I do almost all my software development in a Unix environment, usually I check the toolbox to see if there is already a program that has nearly the functionality I want, and if so then I cobble together a shell script. Sometimes (as with the Sudoku solver) it will be necessary to build a new component, and for that I usually use C since I am comfortable and experienced with it. (Also, if coded in Standard C, odds are that I can install it on whatever platform I need, with little or no adaptation.)
DougGwyn··on Tell HN: C Experts Panel – Ask us anything about C
I'm not sure what your requirement is. Usually things work out if you're careful not to assume any specific value for alignment etc. It may mean a few unused bytes here and there, but keeping things simple and portable often pays off.
DougGwyn··on Tell HN: C Experts Panel – Ask us anything about C
Okay, check my About text. I'll soon remove it, to avoid getting a lot of spam.
DougGwyn··on Tell HN: C Experts Panel – Ask us anything about C
You should be commended for the fast customer service!
DougGwyn··on Tell HN: C Experts Panel – Ask us anything about C
There is no grand goal that I know of. I wish more importance were being placed on keeping existing well-written code working, which includes continued support for what might be considered near-obsolete. If one wanted to design a new (not fully compatible) language, that could have lofty goals; just don't call it "C".
DougGwyn··on Tell HN: C Experts Panel – Ask us anything about C
Try explaining the concept of "scope", starting with nested blocks. It does require some practice. I suggest not unnecessarily reusing identifiers associated with different objects.
DougGwyn··on Tell HN: C Experts Panel – Ask us anything about C
The problem is that if the checks are always performed, the object code is significantly slowed down. If all computers supported the checking in hardware, then we could do it. You don't really want the current C approach (signal) to trigger except in an emergency, because there is no way to insert cleanup/retry/etc. recovery code via a signal handler.
DougGwyn··on Tell HN: C Experts Panel – Ask us anything about C
I tried, but two spaces yielded what you saw.
DougGwyn··on Tell HN: C Experts Panel – Ask us anything about C
Try using "lint" or other code checkers.
DougGwyn··on Tell HN: C Experts Panel – Ask us anything about C
Everybody seems to draw pictures of the raw memory (word-oriented) data.
DougGwyn··on Tell HN: C Experts Panel – Ask us anything about C
UTF-8 encoding works "as is" based on byte strings (char[]). The latest versions of the draft standard provide somewhat more support.

I recommend heading toward a future where only UTF-8 encoding is used for multibyte characters and UCS-2 or similar for wchar_t. There is no need to support several different encodings.

DougGwyn··on Tell HN: C Experts Panel – Ask us anything about C
One possibility is to modify some existing program to include an additional new feature. You should soon develop a sense for what works well versus what causes problems.
DougGwyn··on Tell HN: C Experts Panel – Ask us anything about C
Many uses of strchr do write via a pointer derived from a non-const declaration. When we introduced const qualifier it was noted that they were actually declaring read-only access, not unchangeability. The alternative was tried experimentally and the consequent "const poisoning" got in the way.
DougGwyn··on Tell HN: C Experts Panel – Ask us anything about C
Actually there was no need to disenfranchise non-twos-complement architectures. Now that SIMH has a CDC-1700 emulation, I had planned on producing a C system for it as an example for students who have never seen such a model.
DougGwyn··on Tell HN: C Experts Panel – Ask us anything about C
We would need a specific proposal and assurance that nearly all computers can efficiently provide that service. It is more likely in the POSIX standard.
DougGwyn··on Tell HN: C Experts Panel – Ask us anything about C
How about a Sudoku solver? Send me a request via e-mail.
DougGwyn··on Tell HN: C Experts Panel – Ask us anything about C
There are deficiencies in almost all proposals. Two new functions which avoid the problems are supposed to be published in C202x: strcasecmp and strncasecmp, added in header strings.h (note: not string.h).
DougGwyn··on Tell HN: C Experts Panel – Ask us anything about C
What removal? C11 section 6.7.6.2 specifies the semantics.
DougGwyn··on Tell HN: C Experts Panel – Ask us anything about C
In BRL's MUVES project, we used a 2-character prefix indicating category. E.g., all the external identifiers for our fancy memory allocator began with "Mm", where Mm.h documented the interface for the Mm package only.

To minimize the external identifiers, one could make just the name of a container structure the sole entry access handle, with structure members pointing to the functions. Then use it like:

  #include <Mm.h>
  if ((new = Mm.allo(size)) == NULL)
    Er.abort("out of memory");
DougGwyn··on Tell HN: C Experts Panel – Ask us anything about C
It all depends on how organized previous workers were, and what your goal is for a modification of the source text. Often, headers (dot-h files) document the data structures and interfaces.
DougGwyn··on Tell HN: C Experts Panel – Ask us anything about C
Okay, is there a starting thread for today's C Experts panel? I miss the old net newsgroups.
DougGwyn··on Tell HN: C Experts Panel – Ask us anything about C
Some simple instructions about how to use a thread for conversation would be appreciated. Thanks!
DougGwyn··on Ask HN: Looking for PDP-11 Emulator
If you find SIMH, look for a "software" folder nearby, which contains several operating systems. Some of them, like Unix, may be tricky to install unless you have an installer's guide. BitSavers.org is a good site for documentation and several items of system software.
← PreviousPage 2 of 2