| Anonymous | Login | Signup for a new account | 2013-05-23 19:34 CEST | ![]() |
| All Projects | FPC | Lazarus: Packages, Patches | Lazarus CCR | Mantis | fpGUI | fpcprojects: fpprofiler |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||
| 0021951 | FPC | Compiler | public | 2012-05-06 05:59 | 2012-05-06 16:57 | ||||
| Reporter | Michalis Kamburelis | ||||||||
| Assigned To | Jonas Maebe | ||||||||
| Priority | normal | Severity | minor | Reproducibility | always | ||||
| Status | resolved | Resolution | fixed | ||||||
| Platform | i386 | OS | Debian GNU/Linux | OS Version | (testing) | ||||
| Product Version | Product Build | ||||||||
| Target Version | Fixed in Version | ||||||||
| Summary | 0021951: Using any {$modeswitch xxx} overrides -Sh as specified on the command line | ||||||||
| Description | As far as I understand, the purpose of $modeswitch is to change a particular syntax behavior --- without touching any other behavior. But it seems that using {$modeswitch nestedprocvars} also implicitly changes the state of $H switch: it makes string=ShortString (which is probably something you seldom want in modern code). Compiling the attached testcase with -Sh: $ fpc -Mobjfpc -Sh nestedprocvars_string.pas $ ./nestedprocvars_string 255 aaaa.... Adding {$H+} in the source code (after or *before* {$modeswitch nestedprocvars}) makes it work Ok: string remains equal to AnsiString. The testcase then correctly prints 1000 and 'a' * 1000. On the command-line, -Mnestedprocvars also seems to activate shortstrings, this time only if it's after -Sh. So if you remove {$modeswitch nestedprocvars} from the attached testcase, and try fpc -Mobjfpc -Sh -Mnestedprocvars nestedprocvars_string.pas then string=ShortString. But fpc -Mobjfpc -Mnestedprocvars -Sh nestedprocvars_string.pas is correct: string remains AnsiString. I think it would be cleaner if -Mnestedprocvars and {$modeswitch nestedprocvars} just didn't touch the state of $H at all. These two features (longstrings and nested procs) seem completely unrelated and orthogonal. Tested with FPC 2.6.0 and 2.7.1 (SVN state from 2012-04-22, revision 20993). | ||||||||
| Tags | No tags attached. | ||||||||
| FPCOldBugId | 0 | ||||||||
| Fixed in Revision | 21247 | ||||||||
| Attached Files | |||||||||
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2012-05-06 05:59 | Michalis Kamburelis | New Issue | |
| 2012-05-06 05:59 | Michalis Kamburelis | File Added: nestedprocvars_string.pas | |
| 2012-05-06 15:59 | Jonas Maebe | FPCOldBugId | => 0 |
| 2012-05-06 15:59 | Jonas Maebe | Summary | Using {$modeswitch nestedprocvars} makes string=ShortString => Using any {$modeswitch xxx} overrides -Sh as specified on the command line |
| 2012-05-06 16:27 | Jonas Maebe | Status | new => assigned |
| 2012-05-06 16:27 | Jonas Maebe | Assigned To | => Jonas Maebe |
| 2012-05-06 16:57 | Jonas Maebe | Fixed in Revision | => 21247 |
| 2012-05-06 16:57 | Jonas Maebe | Status | assigned => resolved |
| 2012-05-06 16:57 | Jonas Maebe | Resolution | open => fixed |
| Main | My View | View Issues | Change Log | Roadmap |



