Skip to content
This repository was archived by the owner on Jun 16, 2025. It is now read-only.

Remove a condition which is always true - #741

Merged
siteshwar merged 1 commit into
att:masterfrom
siteshwar:cid253601
Aug 1, 2018
Merged

Remove a condition which is always true#741
siteshwar merged 1 commit into
att:masterfrom
siteshwar:cid253601

Conversation

@siteshwar

Copy link
Copy Markdown
Contributor

'a' is always 97 in decimal, so remove the test to check for it's value.

Resolves: cid#253601

'a' is always 97 in decimal, so remove the test to check for it's value.

Resolves: cid#253601
Comment thread src/cmd/ksh93/sh/string.c
while (op = cp, c = mbchar(cp)) {
state = 1;
switch (c) {
case ('a'==97?'\033':39): {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is testing whether we're on a machine that uses ASCII or EBCDIC. If the latter a has value 129 and escape is 39. Note, however, that Linux on IBM zSeries machines uses ASCII so this compatibility code isn't needed in that environment. It's only needed if using ksh on something like z/OS UNIX. Personally I'd like to remove the EBCDIC compatibility code but it's probably something we should discuss in an issue dedicated to the question.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concur on removing EBCDIC support, would be interested to hear what others think.

@etscrivner

Copy link
Copy Markdown

LGTM

@krader1961

Copy link
Copy Markdown
Contributor

@siteshwar If you want to proceed with this before we've reached a decision on issue #742 please convert that runtime test into a build time test:

#if 'a' == 97
    case '\033':
#else
    case 39:
#endif
    {

@DavidMorano

DavidMorano commented Jul 31, 2018

Copy link
Copy Markdown

@krader1961

If you want to proceed with this before we've reached a decision on issue #742 please convert that runtime test into a build time test:

I know that the more in depth clean-up does not come until later, but ...
I almost feel badly (almost) about butting in on such a small matter, but can this build-time code please be changed into something like:

/* near top of file where we are deciding how to compile */
#if 'a' == 97
#define  CH_WHICH '\033'
#else
#define CH_WHICH  39
#endif

/* down in the depths of the code where ever this is normally */
switch (whatever) {
case CH_WHICH:
   /* stuff */
   break ;
/* other cases */
} /* end switch */

The idea is to get as many stupid conditional compiles out of the more normal code path as much as possible!

Thanks for any consideration.

@krader1961

Copy link
Copy Markdown
Contributor

@DavidMorano What you're proposing is more or less what I proposed in issue #742 if we decide to retain support for EBCDIC systems. Albeit in a more generic fashion applicable to the entire code base. My preference is to drop support for EBCDIC systems and merge this PR as is.

@DavidMorano

Copy link
Copy Markdown

@krader1961

What you're proposing is more or less what I proposed in issue #742 ...

Yes, you are correct. There you stated:

Probably coupled with formal abstractions and preprocessor symbols.

I originally was going to try to stay away from this whole EBCDIC question -- trying in vain to be a "nice" guy -- but your insistence on wanting to get rid of EBCDIC entirely has inspired me to speak out just a little bit on this.

Yes, I agree with you completely! I can not agree with you more. Has not that EBCDIC stuff been around long enough now? I mean really! How long should the world be required to bow down to put up with that crap stuff, especially given that the world has abandoned tons of other stuff much younger than EBCDIC?

IBM deserves respect for many of the things they have done in computing. No question there. But they (IBM) should have transitioned the world away from EBCDIC decades ago now! IBM should have taken the lead in getting rid of EBCDIC from the world. They did not entirely succeed. Now it is our turn. Yes, get rid of support for EBCDIC!

@krader1961

Copy link
Copy Markdown
Contributor

LGTM. It is pretty clear the AST/ksh in its current form is not going to work correctly on an EBCDIC system. And no one outside of IBM has any interest in making it work on such a system.

@siteshwar
siteshwar merged commit ffd2462 into att:master Aug 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants