Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
26730 Discussions

Select case block vs array of function pointers

FilippoMonari
Beginner
257 Views

Hi all, 

I would like some advice about the following. I have a quite big SELECT CASE block where cases are unique integers. The block includes about 200 cases representing different functions. I was wondering if I could get any benefit in terms of speed by replacing the big SELECT CASE block with an array pointers pointing to functions to apply. Thanks in advance.

Regards,

Filippo

0 Kudos
1 Solution
FortranFan
Honored Contributor II
222 Views
3 Replies
JohnNichols
Valued Contributor II
228 Views

Pick the one that is easy to maintain - although 200 seems a lot 

FortranFan
Honored Contributor II
225 Views

@FilippoMonari ,

Since your question is general Fortran, you may want to consider posting it at Fortran Discourse site (and possibly also USENET based comp.lang.fortran) for wider feedback: 

By the way, here's a long thread toward a similar discussion at comp.lang.fortran a while ago that may help you with some pointers:  https://groups.google.com/g/comp.lang.fortran/c/6uROcAIvPcQ/m/ULl1Muz0CAAJ

Ultimately I think you'll have to figure out what works best for you.

FortranFan
Honored Contributor II
223 Views
Reply