Questions tagged [postfix]

10 questions
56
votes
15 answers

Why do we have postfix increment?

Disclaimer: I know perfectly well the semantics of prefix and postfix increment. So please don't explain to me how they work. Reading questions on stack overflow, I cannot help but notice that programmers get confused by the postfix increment…
fredoverflow
  • 6,854
  • 8
  • 39
  • 46
28
votes
11 answers

Avoid Postfix Increment Operator

I've read that I should avoid the postfix increment operator because of performance reasons (in certain cases). But doesn't this affect code readability? In my opinion: for(int i = 0; i < 42; i++); /* i will never equal 42! */ Looks better…
Mateen Ulhaq
  • 968
  • 3
  • 11
  • 21
6
votes
2 answers

Postfix vs Prefix

I have read at a few places, that Postfix is easier to evaluate & easier to convert to Code than Prefix. I understand that if you parse a prefix expression from left to right, you might not be able to evaluate directly(as some operands might be…
nikel
  • 169
  • 1
  • 4
5
votes
2 answers

why use postfix /prefix expression instead of infix?

I understand how to convert infix to postfix/prefix but I do not understand why postfix or prefix expression are used in computer system? What is the advantage of postfix prefix over infix expression?
Joydip Ghosh
  • 77
  • 1
  • 1
  • 3
4
votes
1 answer

Is it worth parsing an infix algebraic expression to postfix and then an expression tree?

I am trying to make a simple expression parser, in which users type an expression in infix notation (for example ln((1+2)(3-4))) to apply some calculations. To make this possible I need to tokenize the expression as a expression tree. I've read in…
JulianSoto
  • 43
  • 5
4
votes
2 answers

Variable assignment in a postfix language

TL;DR is val name <- more readable than name val <-? I'm designing a semi-concatenative, postfix language. I haven't given much thought to the style in which variable are assigned, and now I see that there are two (main) ways to do it. Originally, a…
3
votes
8 answers

Are there real world applications where the use of prefix versus postfix operators matters?

In college it is taught how you can do math problems which use the ++ or -- operators on some variable referenced in the equation such that the result of the equation would yield different results if you switched the operator from postfix to prefix…
Kenneth
  • 2,703
  • 2
  • 21
  • 30
1
vote
1 answer

How do I interpret this postfix right-to-left algorithm?

I'm trying to implement this right-to-left evaluation algorithm of a postfix expression but I can't seem to get it to work. for each token in the reversed postfix expression: if token is an operator: push token onto the operator stack …
CervEd
  • 121
  • 5
1
vote
5 answers

Algorithm for recursive evaluation of postfix expressions

I'm reading Sedgewick's book on algorithms in C and I'm looking for an algorithm to evaluate postfix expressions (addition and multiplication only) without using a stack. I tried to implement one but I always get nowhere. I have a simple C…
caisah
  • 113
  • 1
  • 5
0
votes
1 answer

LDAP with Dovecot

I have a mail server setup with Postfix and Dovecot, and an application server setup with node.js. I have user credentials stored in my application server, and I want to use the same credentials for accessing the mail server. As I understand it, I…
penalosa
  • 429
  • 1
  • 4
  • 5