Recent Posts

Pages: [1] 2 3 ... 10
Sad to hear this.

I did not previously know the story behind the 8-bit byte and how it relates to ASCII. Even today, the C char type is exactly one byte or 8 bits. He changed it from 6 bits to 8 bits.

The wiki article is interesting.
Windows questions / Re: WIN32 ComboBox control
« Last post by CandCPlusPlus on December 03, 2022, 11:43:14 pm »
I ran into this problem with the ComboBox in the Windows API. The only way to change the size of the drop-down arrow of the ComboBox is oddly by changing the font size. I don't know what possessed Microsoft to design the ComboBox like this back in the 90s.
Beginner questions / Re: Container libraries
« Last post by CandCPlusPlus on December 03, 2022, 08:36:20 pm »
When I get around to it, I may create a string library for C that tracks the size of the string with a variable in a struct and I will create various functions that manipulate the struct in a C-style manner. The functions will use the size being tracked in the struct to prevent buffer overflows. I do want to learn various forms of testing to test this custom library as well.
Tips & tricks / Re: Microsoft is apparently supporting C11 and C17 now...
« Last post by CandCPlusPlus on December 03, 2022, 08:24:21 pm »
I have seen a mention here and there of C2X/C23 on Microsoft blogs. I wonder if we'll see full C23 support soon.
Tips & tricks / IUP
« Last post by CandCPlusPlus on December 03, 2022, 08:21:19 pm »
I have not tried IUP with Pelles C but it does look interesting. A cross platform GUI library for C. In theory, it should work with Pelles C but without the cross platform part of IUP. I'll need to update this post, if and when I ever get to testing it. Any thoughts and advice on using it would be welcomed.
Tips & tricks / Re: Help content for Windows API
« Last post by CandCPlusPlus on December 03, 2022, 08:11:02 pm »
If you have found any more possibly useful links, I'll update the original post. I updated the post with a link to web archive for the Visual Studio 2012 help content and I reorganized the entire original post.
Of interest to computer and programing enthusiasts:

Dr Frederick Phillips Brooks Jr, leader of IBM's OS/360 project and the man chiefly responsible for the prevalence of the eight-bit byte, has died at the age of 91.

See full article here: 

John Z
Beginner questions / Re: Reverse Polish Notation
« Last post by Akko on November 28, 2022, 12:26:59 pm »
You are reinventing the Forth language with its RPN syntax and operators working on stack(s)
by building your own virtual machine with switch-based dispatcher. You can find hundreds
of different Forths in the web, from professional to crude, from native-code compilers to slow
interpreters built in Python.

FWIW you might get some ideas from a rather complete Forth system that compiles with Pelles C:
(the dispatcher loop is hidden in file (e)core.mfc in Forth word _[:] using C function pointers
as execution tokens for low-level functions like RPN math functions, I/O, et cetera).
Beginner questions / Re: Reverse Polish Notation
« Last post by frankie on November 23, 2022, 01:52:16 pm »
Hello HellOfMice, John already explained that the very reason for the RPN existence is the elimination of parenthesis describing an arithmetic expression.
The parenthesis are replaced by the stack order of values and the order of operations inputted to the machine.
To define the correct order. starting from standard expressions style (algebraic) some analysis must be operated on the expression before to push operands on the stack and sequences the math operations. This is normally done by the person that punches values on the keyboard of a pocket calculator (HP) or write a Forth program. On other calculators, i.e. TI-59 programmable calculator,the conversion was made via software with its pioneering Algebraic Operating System (AOS) used to evaluate parenthesized arithmetic expressions.
At the bottom there is always an operands stack and a sequence of functions (operators) to compute the result.
All this to say that the RPN is just a way of representation of algebraic expression than a computation procedural method. It was appreciated in computing because it were well tailored to the stack/procedure structure of computers.

Now in case of a compiler that should be able to honor the operators priority you need the same approach used for common languages , that is analyze the expression and build the operands/operators sequence to correctly execute the computation.
In your case you seems to want keep the standard algebraic expression style, but you want to use a pseudo RPN abstarction in your virtual machine, so you need an interpreter that analyze the whole expression and manage the stack and procedures accordingly.
Please note that when you make a call to function that computes a result with 2 operands like:
Code: [Select]
    int a = add(5, 4);You are using, incidentally, the same approach of an RPN evaluation: the compiler pushes on the stack the 2 operands, then performs the procedure on them. The only difference is that the result is not automatically put on the TOS, but normally returned in a CPU register.
Beginner questions / Re: Reverse Polish Notation
« Last post by John Z on November 23, 2022, 01:50:34 pm »

It is possible to have Z = E / (A  +B / C) * D
One result is Z = (E / ((A + B) / C)) * D

If you did it the above way it would be incorrect.  The use of parenthesis in this case would be
Z = (E / (A + (B/C))) *D 
for this case the correct RPN for this would look something like
Z = E A B C / + / D * 

E, A, B and C are pushed onto the stack
division of B by C is done by / into result
A is add to result  is done by + into result
E divided by result is done by / into result
D pushed onto stack
E multiply by D is done by * into result = Z

When converting to RPN the AOS precedence must be followed and where ambiguous the left to right rule is used, check this link: 
Code: [Select]
1 ()   []   ->   .   :: Function call, scope, array/member access
2 !   ~   -   +   *   &   sizeof   type cast   ++   --    (most) unary operators, sizeof and type casts (right to left)
3 *   /   % MOD Multiplication, division, modulo
4 +   - Addition and subtraction
5 <<   >> Bitwise shift left and right
6 <   <=   >   >= Comparisons: less-than and greater-than
7 ==   != Comparisons: equal and not equal
8 & Bitwise AND
9 ^ Bitwise exclusive OR (XOR)
10 | Bitwise inclusive (normal) OR
11 && Logical AND
12 || Logical OR
13 ? : Conditional expression (ternary)
14 =   +=   -=   *=   /=   %=   &=   |=   ^=   <<=   >>= Assignment operators (right to left)
15 , Comma operator

Also Pelles C help file has a section on operator precedence search for "C operator precedence and order of evaluation"

John Z
Pages: [1] 2 3 ... 10